Groups | Blog | Home
all groups > flash actionscript > june 2004 >

flash actionscript : Cannot get AttachMovie to work


tralfaz
6/9/2004 4:29:19 PM
[quoted text, click to view]
created.

Hi Robin, I don't want you to think I am being picky because you explained
everything very well, but just wanted to make sure you know that the number
at the end of the attachMovie function isn't a level, it's a depth. For
instance, if you attach 10 movies to something on _level0, all 10 clips will
be on _level0 at different depths. It's not a big deal except the
difference could cause some frustration in the future! Maybe you already
knew it but just typed too fast. :o)
tralfaz

Lumber Jack
6/9/2004 6:12:49 PM
Cannot get AttachMovie to work

Can somone supply or point me to a BASIC code example of how to implement AttachMovie command.

silvernapalm
6/9/2004 6:51:50 PM
when you attach a movie from the library without placing it on the stage you
must select its' properties and select "export for actionscript".

that allows the movie to be exported with the code that references it in the
actionscript panel.

next you attach the movie to the movie you want it to be a part of:

myMc.attachMovie("idName,", "newName", depth);

the idName is what you specified in the "export for actionscript"
the newName is the instance name of the attached clip.
depth is where it is on stage in relation to the stacking order.

so if i wanted to attach a galleryClip that was in the library to my
placeHolderClip (on _level0)I would:
placeHolderClip.attachMovie("galClip", "galleryPics", 1);


the only thing here is either you have the placeHolderClip on the stage to
begin with or you have created it dynamically via actionscript.

good luck
Robin Nicholl
6/9/2004 7:50:20 PM
On 09/06/04 7:12 pm, in article ca7jv1$5o9$1@forums.macromedia.com, "Lumber
[quoted text, click to view]


Draw a shape on stage. Make it into a new movieclip (Modify > Convert to
symbol).

Delete it from the stage.

Find the new clip in the Library, right-click it (or ctrl-click if you're on
a Mac) and select 'Linkage' from the context menu.

Check 'Export for ActionScript' and 'Export in first frame', and enter a
name in the 'Identifier' field. Let's say you call it 'myThingID'.

Click on an empty frame on the main timeline, then write the following in
the Actions panel:

_root.attachMovie("myThingID","myNewThing",1);

The first word (_root) means that the movieclip wil be attached to the root
timeline. If you want it attached to another instance of a movieclip, then
use that name here.

The first string inside parentheses (myThingID) is a referene to the linkage
name of the movieclip you want to attach. The second is the new name for the
instance you're creating with attachMovie. The number at the end is the
level at which the new instance will be created.

Once you've created it you can start manipulating its properties:

myNewThing._x = 100;
myNewThing._y = 150; // etc.


--
Robin Nicholl
studioalias
Lumber Jack
6/10/2004 8:25:50 PM
Thanks guys, I got it to work just fine.
You should get a job in the macromedia tutorial/refernce deptatment.

Robin Nicholl
6/12/2004 2:28:42 AM
On 10/06/04 12:29 am, in article ca86gb$r1s$1@forums.macromedia.com,
[quoted text, click to view]
Not so much a typo as sloppiness!

--
Robin Nicholl
studioalias
AddThis Social Bookmark Button