Skip to main content
September 13, 2006
Question

problem calling function in attached movie

  • September 13, 2006
  • 1 reply
  • 159 views
In my main timeline I'm attaching a movieclip from the library & then trying to call a function defined in frame one of the attached movieclip - however it does not run ? Can anyone see what is wrong with this code...

var mcRef:MovieClip = _root.target5.attachMovie("menuBar", "MenuBar" + nDepth, nDepth);

(mcRef has the following value - _level0.target5.MenuBar0)

mcRef.createButtons(mcTgt, sPath, nButtons);

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
September 13, 2006
the code in frame 1 of mcRef does not complete execution until the code in the frame that contains your attachMovie() statement completes execution. you are, therefore, trying to use a function before it's defined.

to remedy, you can wait any measurable (in flash) amount of time before executing mcRef.createButtons(). for example, setInterval() can be used with any time delay.