PDA

View Full Version : last question...! Adding a new movie clip instance in actionscript


deanosrs
02-21-2006, 01:52 PM
Hi - sorry for all these questions, this is the last I promise!

If I have a movie clip in the library, how do I add an instance of this clip onto the stage using actionscript?

Viath
02-21-2006, 08:51 PM
You will need to export the movie clip for ActionScript.
In the library, right click your movie clip and select LINKAGE.
Check the box that says EXPORT FOR ACTIONSCRIPT and make sure the box that says EXPORT IN FIRST FRAME is also selected.
In the IDENTIFIER box, type a unique name to identify the movie, for example "myClip" (without quotes).
Click OK to close the Linkage Properties dialogue.

Now you can use attachMovie() to attach your clip like this...

_root.attachMovie("myClip", "MyClip2" ,0);

where myClip is the identifier you used in Linkage Properties, MyClip2 is the NEW INSTANCE NAME of the movie, and 0 is the depth.

If that's not clear, you may want to read this document (http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001397.html).