Actionscript Movement

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

Frame 1:


Frame 2:
if (_root.Button2Dest !== _root.Button2._y){
_root.Button2 += 5

Frame 3:


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.

Try this…

Frame 1


Frame 2

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

Frame 3


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

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

_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.

No problem. I am glad I could help you out :slight_smile: