Hi all… I had the following script which worked fine for my buttons which were sitting on the stage and are called ‘btn1’, ‘btn2’, etc… However I wanted to animate all the buttons so have put them all into a movie clip called buttons, but now my script doesn’t work, I have tried changing all the this targets to _root.buttons.this, but no luck… Any ideas anybody?
numOfBtn = 5;
stop();
for (i=0; i<numOfBtn+1; i++) {
this["btn"+i].num = i;
this["btn"+i].originalY = this["btn"+i]._y; //stores original position
this["btn"+i].onRelease = function() {
//set the frameNum variable to the same as the number button you selected, i use it again in frame 9
frameNum = this.num;
trace("playhead should be sent to "+frameNum+" by btn"+this.num);
//start playing the movie
play();
};
this["btn"+i].onRollOver = function() {
this.play();
for (var j:Number = this.num+1; j<=numOfBtn; j++) {
var newNum:Number = this._parent["btn"+j].originalY + 25;
this._parent["btn"+j].tween("_y", newNum, .5, "easeOutQuad");
_root.line.tween("_y", _root.line.originalY + 25, .5, "easeOutQuad");
}
};
this["btn"+i].onRollOut = function() {
for (var j:Number = this.num+1; j<=numOfBtn; j++) {
var newNum:Number = this._parent["btn"+j].originalY;
this._parent["btn"+j].tween("_y", newNum, .5, "easeOutQuad");
_root.line.tween("_y", _root.line.originalY, .5, "easeOutQuad");
}
this.onEnterFrame = function() {
if (this._currentframe != 1) {
this.prevFrame();
} else {
delete this.onEnterFrame;
}
};
};
}