Hey!

Consider this.
There is a symbol in the library - "Ball".
It has a variable declared in the first frame - "size".
I want to instantiate the symbol and then read the variable value.

Trying to access the variable synchronously, right after the the symbol has
been instantiated, does not work:
----
var ball_mc = _root.attachMovie("Ball", "ball_mc",
_root.getNextHighestDepth());
trace("size = " + ball_mc.size); //"size = undefined"
----
Then I came up with the following solution.
In the first frame of "Ball" symbol, at the end of code I insert the
following statement
----
onLoad();
----

And then inside the main program I register the listener to "onLoad()"
funciton call.
----
var ball_mc = _root.attachMovie("Ball", "ball_mc",
_root.getNextHighestDepth());
ball_mc.onLoad = function() {
    trace("size = " + ball_mc.size); //"size = 20"
}
----
This technique works fine.
However, I don't like the fact that I have manually add onLoad() call to
every symbol which properties or functions I want to access.

Do you think this is the right way to solve the problem?
What is the best way to?

Pasha
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to