PDA

View Full Version : UnattachMC


momoto
02-22-2002, 02:28 AM
Hi, I have a mc with frame action:

i = 0;
while (i<max) {
txtfall = random(400);
attachMovie(1, "abc"+i, i);
_root["abc"+i]._x = random(950);
_root["abc"+i]._y = random(326);
_root["abc"+i]._xscale = txtfall;
_root["abc"+i]._yscale = txtfall;
_root["abc"+i]._alpha = random(100);
i++;
}


It keeps playing thruout the movie, are there another method or action to unattach the mc?

I hd try the followings on a new keyframe, but they didn't work:

_root["abc"+i].removeMovieClip(1);

&

attachMovie(2, "emptyMC"+i, i)

Jesse
02-22-2002, 02:42 AM
I think you need to revise the tutorial on attachMovie. Your code:
attachMovie(1, "abc"+i, i);
shouldn't actually do anything... does it?
If '1' is the linkage name it should have quotes around it... if it's a variable you should rename it as variables shouldn't begin with a number...
Once that's done this shold work fine:
_root["abc"+i].removeMovieClip();
(In a loop of course if you want to remove them all). Goodluck.

momoto
02-22-2002, 05:54 PM
Thanks Jess,

But this code works fine in my inital MC without the quotes around the linkage name.

--------------------------------------------------------------------------------attachMovie(1, "abc"+i, i);
--------------------------------------------------------------------------------

It's just the matter of how can I unattach this mc on a new keyframe on the same layer?

Or will you suggest me to use unloadMovie instead?

If using code:
--------------------------------------------------------------------------------_root["abc"+i].removeMovieClip();
--------------------------------------------------------------------------------

then why is the blanket after removeMovieClip is empty? Should I add the name or the linkage name inside the blanket?

momoto
02-22-2002, 05:56 PM
Sorry for the breaking layout of the code.

--------------------------------------------------------------------------------attachMovie(1, "abc"+i, i);
--------------------------------------------------------------------------------

and

--------------------------------------------------------------------------------_root["abc"+i].removeMovieClip();
--------------------------------------------------------------------------------

momoto
02-22-2002, 05:57 PM
why it's breaking again??

attachMovie(1, "abc"+i, i);

and

_root["abc"+i].removeMovieClip();

momoto
02-28-2002, 06:45 PM
do anyone know is this script got error or not? is inside the blanket suppose to be empty? or I need to put the linkage name "1" of the mc?

_root["abc"+i].removeMovieClip();

(I can't use this action to remove a mc on the same level but a previous keyframe)

---------------------
action on previous keyframe:

i = 0;
attachMovie("1", "abc"+i, i)


:confused: