Event Handler problems MC Button issues

I think actually you explained it better than i can.
we are looping throught the sequence 52 times(from i=0 to i=51 inclusive) and each time a value of 1 is added to i.On the first loop, i will be 0, so the next line gives us this[“myState”+0].ivar = 0;

this - refers to the timeline, so you may well be able to replace with _root but later if you decide to load the movie into another it will cause you problems.
[“myState”+0] just refers to the movieclip myState0
its as if “this” or (_root) is an array and flash knows to look in “this” for the stuff inside the square brackets which it is what it is looking for.
ivar is a property we have given each mc and in this case it has a value of 0.
you can call ivar whatever you want,it doesn`t matter.
like saying Object.property=value
So each mc has a property ivar but they are all unique values making them useful.
The next line gives us
this[“myState”+0].onPress = function() {
loadMovie(“movie”+this.ivar+“.swf”, “container”);
//in other words (movie0.swf,“container”)
this.enabled = false;
};

inside a callback function “this” refers to whatever is calling the function not to the timeline as you might expect. So this just means(on our first loop)
myState0.enabled = false;

Then it does the whole thing again with 1 etc.

Thanks AGAIN Stringy. It seems so easy once the code is written and explained. I just wonder when I will ever get to the point when I will be able to work through these things on my own and be able to write the script myself. I would have made this such a long process never realizing that it could all be addressed with one block of script rather than basically doing the same thing over and over for each mc. I just hope one of these days the lightbulb finally comes on…

:smiley:

We have all been there Jillymo but you are doing the right thing in trying to understand code rather than just copy it blindly. Once you have used it a couple of times you`ll wonder what all the fuss was about.

L I hope so!