0
votes

I'm in class file right now and made a new movie clip using the linkage name

var mc = new ExampleLinkageName();
addChild(mc);

all good, I can see mc on the stage. In the ExampleLinkageName movieclip, I have a variable defined in it (on the physical timeline) called test.

In my class, I try trace(mc.test) and I get null. Any idea how I can read that variable?

1

1 Answers

1
votes

You are doing it right, but the variable has not been created (the first frame actions has not executed) when you try to access it. If you (for debug purpose) try to access mc.test in the next frame of your timeline you will get the correct variable value. Or add an ENTER_FRAME EventListener to the created Movieclip like this:

var mc : Symbol1 = new Symbol1();
mc.addEventListener(Event.ENTER_FRAME, initHandler);
addChild(mc);

function initHandler(event : Event) : void
{
    trace(mc.test);
    mc.removeEventListener(Event.ENTER_FRAME, initHandler);
}