# Help with Button Animation

**URL:** https://forum.kirupa.com/t/help-with-button-animation/254904
**Category:** flash
**Created:** [March 17, 2008, 5:01am UTC](https://forum.kirupa.com/t/help-with-button-animation/254904 "2008-03-17T05:01:38Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![kramdraw85](https://avatars.discourse-cdn.com/v4/letter/k/c2a13f/32.png) [@kramdraw85](https://forum.kirupa.com/u/kramdraw85)
#### Post date: [March 17, 2008, 5:01am UTC](https://forum.kirupa.com/t/help-with-button-animation/254904/1 "2008-03-17T05:01:38Z")

</div>

So I’m trying to make a menu similar to the one on this site [http://www.moma.org/exhibitions/2007/seurat/seurat.html](http://www.moma.org/exhibitions/2007/seurat/seurat.html). When each button is pressed it goes to the top and the others change order respectively. So far I have this:

pos1=40;  
pos2=80;  
pos3=120;  
pos4=160;

import mx.transitions.Tween;  
import mx.transitions.easing.\*;

//  
// Array to keep track of current box positions  
//  
var boxv:Array = new Array(box1,box2,box3,box4);  
var boxc:Number = boxv.length;

Array to store available y-positions for boxes.

var yPosv:Array = new Array(pos1,pos2,pos3,pos4);

for (var i=0; i\<boxc; i++)  
{  
boxv\*.\_y = yPosv\*;  
}

//  
// function moveToTop()  
//  
// Moves a box to top pos, moves others down  
//  
this.moveToTop = function(box:MovieClip):Void  
{  
// if box is already at the top, do nothing  
if (boxv[0] == box) return;

```
for (boxPos = 1; boxPos&lt;boxc; boxPos++)
{
    if (boxv[boxPos] == box) break;
}

boxv.splice(0,0,boxv.splice(1,1));
    boxv.splice(0,0,boxv.splice(1,1));

for (var i=0; i&lt;boxc; i++)
{
    new Tween(boxv*, "_y", Elastic.easeOut, boxv*._y, yPosv*, 1, true);
}

```

}

for (var i=0; i\<boxc; i++)  
{  
boxv\*.onRelease = function()  
{  
this.\_parent.moveToTop(this);  
}

}

Right now when the top button is pressed nothing happens, but when and other one is the top button moves down to the second button position.  
Not sure what exactly I need to change to make it work. Any ideas?
