# A Question to do with Movement Using ActionScript

**URL:** <https://forum.kirupa.com/t/a-question-to-do-with-movement-using-actionscript/65137>\
**Category:** flash\
**Created:** [September 23, 2004, 9:31am UTC](https://forum.kirupa.com/t/a-question-to-do-with-movement-using-actionscript/65137 "2004-09-23T09:31:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mars79](https://avatars.discourse-cdn.com/v4/letter/m/7993a0/32.png) [@mars79](https://forum.kirupa.com/u/mars79)\
**Post date:** [September 23, 2004, 9:31am UTC](https://forum.kirupa.com/t/a-question-to-do-with-movement-using-actionscript/65137/1 "2004-09-23T09:31:11Z")

</div>

I went through the tutitoral my question is what action script do you use to stop the box from moving for instance you can rollover to make the box move but then how do you make it so when you roll out the box will stop?

Thanks  
Marcel

---

<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:** [September 23, 2004, 11:18am UTC](https://forum.kirupa.com/t/a-question-to-do-with-movement-using-actionscript/65137/2 "2004-09-23T11:18:15Z")

</div>

whats ur actionscript to make it move?  
if it’s a movie that plays on rollOver:

on(rollOut){  
box.stop();  
}

---

<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:** [September 27, 2004, 7:54am UTC](https://forum.kirupa.com/t/a-question-to-do-with-movement-using-actionscript/65137/3 "2004-09-27T07:54:17Z")

</div>

Hi my friend gave me some action script to move an object up and down but they are all movies I need to know what action script to use if I am working with buttons to make the object move up and down. Thanks

---

<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:** [September 27, 2004, 2:12pm UTC](https://forum.kirupa.com/t/a-question-to-do-with-movement-using-actionscript/65137/4 "2004-09-27T14:12:08Z")

</div>

Something like this:

```auto
myListener = new Object();
keyDown = function () {
  trace ("You pressed a key.");
  // put anything you want to do in there
}
Key.addListener(myListener);

box.onRollOver = function () {
  myListener.onKeyDown = keyDown ;
} ;
box.onRollOut = function () {
  delete myListener.onKeyDown ;
} ;[/As]
If you need something more specific, please post the code you're using.
```

---

<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:** [September 30, 2004, 7:50am UTC](https://forum.kirupa.com/t/a-question-to-do-with-movement-using-actionscript/65137/5 "2004-09-30T07:50:42Z")

</div>

Shot for the feedback but I wasn’t talking about actual buttons on the keyboard I was talking about making buttons in flash and using them to make the object move up and down. 🐇

---

<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:** [September 30, 2004, 12:24pm UTC](https://forum.kirupa.com/t/a-question-to-do-with-movement-using-actionscript/65137/6 "2004-09-30T12:24:59Z")

</div>

Uhh if your running flash MX look under your… program files\>macromedia\>flash mx\>samples\>fla(i think thats the folder might be just in samples). They have an example of every movement type, just copy and paste and change the mvclips names. hope that helped, if your new to flash look over some of the other examples in there to help you grasp the concept.

---

<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:** [September 30, 2004, 1:12pm UTC](https://forum.kirupa.com/t/a-question-to-do-with-movement-using-actionscript/65137/7 "2004-09-30T13:12:07Z")

</div>

It’s the asme kind of code 🙂

```auto
myListener = new Object();
move = function () {
  this._x += 5 ;
  // put anything you want to do in there
}

clip.onRollOver = function () {
  box.onEnterFrame = move ;
} ;
clip.onRollOut = function () {
  delete box.onEnterFrame ;
} ;[/As]
```
