Hi trying to do something really simple here but its not working properly. Using Flash 8.
I have 3 movieclips (to be turned into buttons) on the main stage, instances named: "charm1", "charm2" and "charm3". On the main timeline, I have this code. Using a for loop I'm trying to assign a bit of code to each movieclip when its clicked on:
Code:for (i = 1; i < 4; i++){ trace ("i value:" + i); // displays, "i value:1", "i value:2", "i value:3" like it should _root["charm" + i].onPress = function(){ trace ("i value:" + i); //displays "i value:4" for all 3 buttons, makes no sense! }; }
Why is my value for i, being incremented? Can anyone help, are there certain bits of code that aren't allowed inside a For loop?
Cheers
Si




Reply With Quote