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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to put 2 keypress event 1

Status
Not open for further replies.

immovfp

Programmer
Jun 18, 2002
6
FR
Hi,
I want if i can to put

on (keyPress "r",keyPress "R")
{

}

i have a error in flash compilation
he says that doublon in event.

How do this code ? please.

thanks
Olivier
 
If you're using flash 2004 you need to create a key listener object, then add the listener the the Key class

Code:
var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
    trace("Key char: "+chr(Key.getAscii()));
    if (chr(Key.getAscii()) == "r" || chr(Key.getAscii()) == "R") {
// they clicked R or r put your code here		
} 
};
Key.addListener(cp.keyListener);

Thanks
Tricia
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top