# Ups and downs

**URL:** <https://forum.kirupa.com/t/ups-and-downs/23516>\
**Category:** Uncategorized\
**Created:** [June 18, 2003, 10:34pm UTC](https://forum.kirupa.com/t/ups-and-downs/23516 "2003-06-18T22:34:38Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![crinity](https://avatars.discourse-cdn.com/v4/letter/c/ba8739/32.png) [@crinity](https://forum.kirupa.com/u/crinity)\
**Post date:** [June 18, 2003, 10:34pm UTC](https://forum.kirupa.com/t/ups-and-downs/23516/1 "2003-06-18T22:34:38Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 18, 2003, 11:39pm UTC](https://forum.kirupa.com/t/ups-and-downs/23516/2 "2003-06-18T23:39:01Z")

</div>

is this in a movie clip? or wheres the code that fires the Key.Isdown ??

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 18, 2003, 11:41pm UTC](https://forum.kirupa.com/t/ups-and-downs/23516/3 "2003-06-18T23:41:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 18, 2003, 11:42pm UTC](https://forum.kirupa.com/t/ups-and-downs/23516/4 "2003-06-18T23:42:27Z")

</div>

im just wondering where you code is for the key press.

is it on a Movieclip? in a onClipEvent

?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 19, 2003, 12:02am UTC](https://forum.kirupa.com/t/ups-and-downs/23516/5 "2003-06-19T00:02:14Z")

</div>

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); }

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 19, 2003, 12:05am UTC](https://forum.kirupa.com/t/ups-and-downs/23516/6 "2003-06-19T00:05:46Z")

</div>

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);  
}

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 19, 2003, 10:40pm UTC](https://forum.kirupa.com/t/ups-and-downs/23516/7 "2003-06-19T22:40:38Z")

</div>

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);
