Saturday, September 01, 2007

MovieClip Identifiers

Here's something interesting I found in Flash CS3 using ActionScript 3. Say you have the following:

Frame 1:
trace(this.hasOwnProperty("my_mc");
trace(my_mc);

Frame 2:
A MovieClip instance named "my_mc"
trace(this.hasOwnProperty("my_mc"));
trace(my_mc);

The output is:
true
null
true
[object MovieClip]

So Flash assigns the property identifier "my_mc" to the current timeline's instance at the start of the movie, before the actual instance occurs on the stage. Then when it does, that property is populated with a reference to the instance. I assume the identifier is created at compile time.

No comments:

Post a Comment