« The AdminTool | Main | Flash 8 Samples »

MovieClip.attachMovie - Clarification

Headerbutton_flash_actionscript_2

Can I attachMovie from a loaded SWF into any other timeline??  No, sorry, it's lame, you can't.  Just like you can't duplicationMovie to another timeline - again, lame lame lame!  But a post on the LiveDocs I posted a while back has some people thinking that I *can* do this or that I found a *way*.  I haven't, I've just had to work around it like everyone else.  I don't know if this is fixed in 8ball or not, but one can only hope.

http://livedocs.macromedia.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Flash_MX_2004&file=00001487.html

The work arounds I've done usually include designing my code to build WITHIN the loaded SWF (that has the library assets I wish to attach).
So, IE:

1.  load swf into movie clip _level0.mc_0
2.  AFTER the loaded swf is completely loaded, createEmptyMovieClip INSIDE of _level0.mc_0 called "content_mc"
3.  AttachMovie (from level0) into _level0.mc_0.content_mc
4.  Now, you can attachMovie from _level0.mc_0 into your main content.

So essentially, you're not having your main content out on stage, then loading a SWF to do attachMovie with.  You're creating a movieclip that will be attached AFTER you load the swf that has library items you wish to attach to your main content.

Hope that all makes sense!  I did this with a jigsaw puzzle app where the image/video had to be dynamic on a day-to-day basis - worked great!

hth, - John

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/t/trackback/2387936

Listed below are links to weblogs that reference MovieClip.attachMovie - Clarification:

Comments

Post a comment

If you have a TypeKey or TypePad account, please Sign In

mission furniture | ikea furniture | thomasville furniture | antique furniture | deck patio furniture | kid furniture | rustic furniture | jordan furniture | star furniture | baby furniture