I have 5 buttons and the below code, basically the way it works is onRelease it send the playhead to a frame label. On rollOver it plays an animation, and onRollOut it reverses the animation. Works really well. The buttons all sit on top of each other, so when the first button is rollOver I need to move the others down, i.e. btn2, btn3, btn4. And if button 2 is rolled over I only need to move btn3 and btn4 (hopefully that makes sense) but the statement can't fit in with my code... Can I use an If somewhere? Can anyone see that working?
Current Code
Edited not written in code thoughCode:numOfBtn = 5; stop(); for (i=0; i<numOfBtn+1; i++) { this["btn"+i].num = i; this["btn"+i].onRelease = function() { gotoAndStop("frm"+(this.num+1)); }; this["btn"+i].onRollOver = function() { this.play(); }; this["btn"+i].onRollOut = function() { this.onEnterFrame = function() { if (this._currentframe != 1) { this.prevFrame(); } else { delete this.onEnterFrame; } }; }; }
If anyone can get that too work in code form would be much appreciated! Do I even have the right idea? I hope so...Code:numOfBtn = 5; stop(); for (i=0; i<numOfBtn+1; i++) { this["btn"+i].num = i; this["btn"+i].onRelease = function() { gotoAndStop("frm"+(this.num+1)); }; this["btn"+i].onRollOver = function() { if "btn1" rollOver btn2.tween("_y", btn2.originalY + 25, .5, "easeOutQuad"); btn3.tween("_y", btn3.originalY + 25, .5, "easeOutQuad"); btn4.tween("_y", btn4.originalY + 25, .5, "easeOutQuad"); else "btn2" rollOver btn3.tween("_y", btn3.originalY + 25, .5, "easeOutQuad"); btn4.tween("_y", btn4.originalY + 25, .5, "easeOutQuad"); else "btn3" rollOver btn4.tween("_y", btn4.originalY + 25, .5, "easeOutQuad"); this.play(); }; this["btn"+i].onRollOut = function() { this.onEnterFrame = function() { if (this._currentframe != 1) { this.prevFrame(); } else { delete this.onEnterFrame; } }; }; }





Bookmarks