I have 6 buttons ( web1, web2... web6) and I want to have the code for their "on" actions to be written dynamicly. so here is my code for onRollOver.
It assigns the function to each button, that much works. My problem is that the function assigned to each button is referencing the latest set of variables everytime you mouse over them. Is there a way to have flash, in this instance, make the code: section+itemNumber end up as "web4" in the function for every time the button "web4" is rolled over while having it be "web2" everytime the "web2" button is rolled over?
as it is all my buttons' functions end up looking at "web6" since the last value of "itemNumber" is 6.
code:
for (pp = 1; pp < 7; pp++) {
section = "web";
itemNumber = new Number();
itemNumber = pp;
menuSystem[section + itemNumber].onRollOver = function (){
_root.n = _root.n + 1;
trace(section + itemNumber);
_root.menuDisplay = section + itemNumber;
duplicateMovieClip("_root." + section + "info" , section + "info" + itemNumber , _root.n);
_root[section + "info" + itemNumber].gotoAndPlay("in");
}
}
any help is much appriciated
