Going to a frame and accessing a variable, at one shot

Hi guys,

I am sure this is a bug with flash, and looking for a smart workaround.

Now I have a 20 frame movieclip (named mc), and by default the playhead is stopped at frame 0 of that movieclip. At frame 10 I have a movieclip instance there named “apple”. Now I want to tell mc to go to frame 10, and immediately access “apple” movieclip. This is what I do (from the main timeline):

mc.gotoAndStop(10);
trace(mc.apple);

it prints out null (appled is undefined). However, when I put a timer (say of 5 milliseconds) before calling the trace statement, then it works and can access apple.

I dont want to rely on timers, since the timer duration depends on different circumstances. At the same time, I do not want to put code anywhere except the first frame of the main timeline. How can such a thing be solved? Just to make it more difficult (since I know the kind of solution some will be suggesting), at frame 0 of mc, we also have a different movieclip named apple as well! :slight_smile:

Thanks guys