So I’m trying to make a menu similar to the one on this site 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<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<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?