Key Up actionscript
- JOECANl
-
JOECANl
- Member since: Feb. 20, 2009
- Offline.
-
- Forum Stats
- Member
- Level 05
- Blank Slate
Im Currently making some in flash where when i realse the left key i want a MC to go to a certain frame i tried something like
- on (Key.onKeyUp (Key.LEFT)) {_root.Character.gotoAndStop(1);} -
but didnt work i then checked the net with little help and was wondering if anyone could tell me the the right mouse event code that i would need :P
Safe Darlin' :P
- Denvish
-
Denvish
- Member since: Apr. 25, 2003
- Offline.
-
- Send Private Message
- Browse All Posts (15,977)
- Block
-
- Forum Stats
- Member
- Level 46
- Blank Slate
Best bet is a key listener. These actions on a frame on the main timeline:
kl=new Object();
kl.onKeyDown=function(){
if(Key.getCode()==32){ //SPACEBAR
//DO STUFF
}
}
kl.onKeyUp=function(){
if (Key.getCode()==32){ //SPACEBAR
//DO STUFF
}
}
Key.addListener(kl);
If you need to know the keycodes for left, right etc, you can use this thingy
- adam2510
-
adam2510
- Member since: Oct. 2, 2005
- Offline.
-
- Forum Stats
- Member
- Level 13
- Blank Slate
on (keyPress "LEFT") {
_root.Character.gotoAndStop(1);
}
that key syntax doesnt exist
- adam2510
-
adam2510
- Member since: Oct. 2, 2005
- Offline.
-
- Forum Stats
- Member
- Level 13
- Blank Slate
- JOECANl
-
JOECANl
- Member since: Feb. 20, 2009
- Offline.
-
- Forum Stats
- Member
- Level 05
- Blank Slate
kl=new Object();
kl.onKeyDown=function(){
if(Key.getCode()==32){ //SPACEBAR
//DO STUFF
}
}
kl.onKeyUp=function(){
if (Key.getCode()==32){ //SPACEBAR
//DO STUFF
}
}
Key.addListener(kl);
Beautiful mate it works perfectly now thank you so much :P
Safe Darlin' :P



