|
-
http://pat.theorigin.net
rendering variables
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
-
this might not be the best way but i think it works
code:
for (pp = 1; pp < 7; pp++) {
section = "web";
itemNumber = new Number();
itemNumber = pp;
menuSystem[section + itemNumber].itemNumber=itemNumber
menuSystem[section + itemNumber].onRollOver = function (){
_root.n = _root.n + 1;
trace(section + itemNumber);
_root.menuDisplay = section + this.itemNumber;
duplicateMovieClip("_root." + section + "info" , section + "info" + this.itemNumber , _root.n);
_root[section + "info" + this.itemNumber].gotoAndPlay("in");
}
}
-
http://pat.theorigin.net
holy hell, it's alive!
thank you! I can't believe you understood that..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|