i under stand how you can do key.isdown(key.RIGHT) is there something so like when i let go it will trigger something so like when i press right it animates running and when i let go he is animated standing thanks alot
is this in a movie clip? or wheres the code that fires the Key.Isdown ??
yes i have like a movie clip
guy
-idle
-run
-shoot
those 3 movie clips are in the guy movie clip i asumed thats how you did it im probly rong but what i want it to do is if im holding right the guy runs and when i let go it plays idle
is that more clear sorry about before
im just wondering where you code is for the key press.
is it on a Movieclip? in a onClipEvent
?
ok if the code is in a Clip Event… try this code…
assuming the “standing Still” mc is in frame1, and the running is in frame 2 (thats waht i’d use etc) =)
onClipEvent(enterFrame){
if(Key.isDown(13)){
this.gotoAndStop(2);
}else{
this.gotoAndStop(1);
}
thanks i under stand
now i have one more question is this correct
onClipEvent(enterFrame){
if(Key.isDown(key.right)) && (key.isdown(key.control)) {
this.gotoAndStop(3);
}else{
this.gotoAndStop(1);
}
that is a frame based way to do it… looks good, except RIGHT might have to be capitalized.
another way is event based
function onKeyDown(){
if(Key.getCode()==Key.RIGHT)
gotoAndStop(3);
}
function onKeyUp(){
if(Key.getCode()==Key.RIGHT)
gotoAndStop(1);
}
Key.addListener(this);