Skip to main content
Inspiring
September 24, 2008
Answered

AS3 equiv for attachMovie

  • September 24, 2008
  • 2 replies
  • 1632 views
hello -- i've searched the docs and haven't found the AS3 equivalent for...

attachMovie("mc","new_mc", 1)

any help?

thanks > mark
This topic has been closed for replies.
Correct answer jpsoul
addChild(new movieClipClassName()); // where movieClipClassName is the name of the exported class in your library

2 replies

Colin Holgate
Inspiring
September 29, 2008
jpsouls' example wouldn't do all of the things you have in attachMovie. If you have a Library thing set for sharing, using the name "mc", then these lines would do all that your attachMovie did:

var newmc:mc = new mc();
newmc.name = "new_mc";
addChildAt(newmc,1);

Quite often you only want the movieclip to be on top of everything, is which case you can say:

addChild(newmc);

which would be like using getNextHighestDepth() for the layer number in AS2.


jpsoulCorrect answer
Participating Frequently
September 24, 2008
addChild(new movieClipClassName()); // where movieClipClassName is the name of the exported class in your library