Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

display a pressed key

Status
Not open for further replies.

msereno

Technical User
Jul 17, 2003
1
PT
hi, I´m still new working with flash. I'm using Flash MX and would like to make a small interactive program for my 2 year old.

He recognizes some letters, and I would like to build a simple movie that displays a letter each time he presses a keyboard letter.

Example: if he presses "A" we would see an big A on screen. I built a simple movie of fade in letter, but don't know how to make that letter change according to the key pressed on the keyboard.

This small program is just the begining of a project of educational programs that I would like to include in my son's web page so any suggestions are also welcome.

Thank you all for your help
msereno
 
one way

//add all code to main timeline

Key.addListener(Key);
Key.onKeyDown = function(){
var dwn = String.fromCharCode(this.getAscii());
if (dwn.length) this.broadcastMessage("onKey"+dwn+"Down");
}

//dynamic text box on stage instance name mybox

Key.addListener(this);
this.onKeyADown = function(){
//clear previous entry
mybox.text = "";
mybox.text = "A pressed";
}
this.onKeyBDown = function(){
mybox.text = "";
mybox.text = "B pressed";
}
//and so on


_______________________________________
You know you're old if you can remember when bacon, eggs and sunshine were good for you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top