I know this is simple, but I don't know how to do it.
I'm trying to make a horizontal menu. There are 4 menu items right now. I'm trying to figure out how to click on button one, so that button one (after clicking) slides to the left, and the other buttons slide to the right, showing the menu in between.
easy.
but then when I click on button two, I want it to close the menu for button one (everything going back to the original state), then open menu for button 2 by having buttons 1 and 2 slide to the left, and button 3 and 4 slide to the right, showing the menu in between 2 and 3.
The buttons are all in a movie clip. When that movie clip opens, the buttons fade in with stop action at 19.
This pic shows the frames for the menus sliding open and closed.
A good place to start is with placing your nav buttons on the stage. For example to get four in a row. Here is an example of how I would start this. Boxo in this case is a reference to a movieclip in the library that is used to build the navigation.
PHP Code:
var movLev:MovieClip = this;
var maxBoxes:Number = 4;
function initBoxes(){
trace("initBoxes has been reached")
for(var i:Number = 0;i<=maxBoxes;i++){
var testClip = _level0.attachMovie("boxo","boxo"+i,_level0.getNextHighestDepth());
trace("testClip: "+testClip);
testClip._x = 50*i;
testClip.homePoint = testClip._x;
testClip.orderVal = i;
setActions(testClip);
testClip.onRelease = clickAction;
}
}
function clickAction():Void{
trace("this.orderVal: "+this.orderVal);
resetPositions();
if(this.orderVal<maxBoxes){
var minVal:Number = this.orderVal+1;
for(var i:Number=minVal;i<=maxBoxes;i++){
movLev["boxo"+i]._x =movLev["boxo"+i].homePoint+50;
}
}
}
function resetPositions(){
for(var i:Number=0;i<=maxBoxes;i++){
movLev["boxo"+i]._x =movLev["boxo"+i].homePoint;
}
}
initBoxes();
There is a still more work that would need to be done to make what you're talking about, but this is a good jump off point.