# Actionscript Movement

**URL:** <https://forum.kirupa.com/t/actionscript-movement/6994>\
**Category:** flash\
**Created:** [October 21, 2002, 7:15pm UTC](https://forum.kirupa.com/t/actionscript-movement/6994 "2002-10-21T19:15:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sorcerer](https://avatars.discourse-cdn.com/v4/letter/s/58956e/32.png) [@Sorcerer](https://forum.kirupa.com/u/Sorcerer)\
**Post date:** [October 21, 2002, 7:15pm UTC](https://forum.kirupa.com/t/actionscript-movement/6994/1 "2002-10-21T19:15:36Z")

</div>

I am working on a collapsable menu for a website but I’m having some problems making the main buttons shift down when an button is expanded. I’ve seen the actionscript movement tutorial on this website but when I try to use it on my menu I have problems. The tutorial on this site has the movement set to a clip event. However I need to be able to control when they move up or down. I tried putting a MC with 3 frames in it to control my movment but it didn’t work. It looked like this

```auto

Frame 1:

Stop();

Frame 2:
if (_root.Button2Dest !== _root.Button2._y){
_root.Button2 += 5
gotoAndPlay(3);
}
gotoAndStop(2);

Frame 3:

gotoAndPlay(2);

```

When I did this my 2nd button just jumps to where it is supposed to end up instead of moving there by 5 pixel increments. Any help on this would be great.

---

<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:** [October 21, 2002, 7:54pm UTC](https://forum.kirupa.com/t/actionscript-movement/6994/2 "2002-10-21T19:54:50Z")

</div>

Try this…

Frame 1

stop();

Frame 2

```auto
if (_root.Button2Dest !== _root.Button2._y){
_root.button2.onEnterFrame = function() {
_root.Button2 += 5;
}
}

```

Frame 3

gotoAndPlay(2);

Not sure if it will work, but in theory it should.

---

<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:** [October 21, 2002, 9:07pm UTC](https://forum.kirupa.com/t/actionscript-movement/6994/3 "2002-10-21T21:07:28Z")

</div>

I got it to work, had to flip the script around though so it looks like this:

```auto

_root.Button2.onEnterFrame = function() {
	if (_root.Button2Dest !== _root.Button2._y){
		_root.Button2._y += 5;
	}
}

```

The other way would play but wouldn’t stop at the destination. I was also able to remove the blank movieclip completely and add these commands right to the button.

Thanks a ton.

---

<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:** [October 21, 2002, 9:51pm UTC](https://forum.kirupa.com/t/actionscript-movement/6994/4 "2002-10-21T21:51:59Z")

</div>

No problem. I am glad I could help you out 🙂
