Heya guys, I am assigning the button behaviors to a set of movieclips through a for loop, however, I am coming up against something where I know what is happening, but don't know how to fix it.
Basically, inside that for loop I assign each of the button behaviors as a function but I don't know how to evaluate the counter in the function, rather than having it just literally written into it. instead of "section_"+ _root.i being section_1, section_2, etc...it is literally written in each of the buttons as "section_"+_root.i and so each button has exactly the same code and all go to the last section (last value of i) when clicked. How can I have it so that each function has the proper code it in? is this even the proper way to go about this? Is there a way to 'force' the evaluation of that counter in that function when it is being assigned to the MC? code: function buttonBehavior ():Void { for (_root.i=1;_root.i<8;_root.i++) { _root["mb_"+_root.i].onRollOver = function() { this.gotoAndPlay("over"); } _root["mb_"+_root.i].onRollOut = function() { this.gotoAndPlay("out"); } _root["mb_"+_root.i].onRelease = function() { _root.gotoAndPlay("display_frame"); loadMovie("section_"+_root.i+".swf", "load_target"); } } } (btw, I added the _root. to each of the i's so that the function could 'see' it. thanks in advance! -Alex _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com