This content has been marked as final. Show 5 replies
why not just type target_mc.theVar as in
myListener.onLoadInit = function(target_mc)
target_mc._alpha = 20
target_mc.myVar = 2000;
crap. You're right. What I was doing was creating empty movieclips and setting vars in them, and then loading images into them. But loading images into them seems to wipe out the variables I set. So then using target_mc.theVar returned undefined.
Here is part of the difference. Noticing what class type something is: So if you have code that looks like this:
This assumes that someClipName1 and 2 both exist on the same timeline as this code. Notice how the first reference target1 is a string. In that case you need the array access to say "Look inside of home for something called by the value of this string, namely someClipName1." The other one, target2, is of type movieclip so Flash already knows that it is a movieclip.
So when you read the help files for things like MovieClipLoader.onLoadInit you can notice what types it returns and then know exactly how handle them. And you are correct when you load external content it will wipe out any variables/properties you set earlier.
thanks very much for taking the time to explain. Think I get this now.
Yea the trouble spot for me was not realizing the variables get zapped when loading a jpg into the clip. So I thought I was referencing wrong.