Hi guys, i’m creating a list of buttons for my website and herefore i’m using attachMovie to dublicate them.
My code looks like this.
n=0; num=5;
while(n < num) {
yPos=27+33*n; n++; attachMovie("button_mc", "button"+n ,n, {_x:0, _y:yPos});
this["button"+n].onRollOver = function() { _root["button"+n].gotoAndPlay("_over"); };
this["button"+n].onRollOut = function() { _root["button"+n].gotoAndPlay("_out"); };
}
When i launch i see 5 buttons. Now the problem is, when i hover the first button (on top) the one which is drawn last begins to “play”. The buttons are movieclips.
Basically, my question is: How can i add a function to each new button that is being made.
thx