View Full Version : Removing a MC
Pissed_Peasant
July 13th, 2005, 09:38 PM
I hate to ask somthing like this but my searchs keep coming up empty and I'm clean out of ideas.
How can I remove MCs?
expensive_pen
July 13th, 2005, 10:21 PM
removeMovieClip();
Krilnon
July 13th, 2005, 10:23 PM
MovieClip.removeMovieClip()
Edit: Didn't see pen's response...
You can use MovieClipLoader.unloadClip() if you originally used MovieClipLoader.loadClip() to load it.
MovieClip.unloadMovie() essentially empties the contents of of container MC.
Pissed_Peasant
July 13th, 2005, 11:03 PM
Well I was doing the right thing then. It just doesn't seem to want to work.
mcName.removeMovieClip();
Doesn't work.
removeMovieClip(mcName);
Also doesn't work.
I'm positive I got all the paths right, and the condition works.
What am I doing wrong?
Thanks for your time.
Limitlis
July 13th, 2005, 11:30 PM
are the MC names correct? i think flash is really case Sensitive.
Maybe post your files
expensive_pen
July 13th, 2005, 11:36 PM
yeah i think you have to have creted the MC dynamically to use removeMovieClip()
not sure if your MC is. but im not sure to remove a regular mc. i have an idea though.
ahh yes it worked, but its ugly, and there is probably a more elegant solution...
what you have to do, it create another movieclip in the same depth as the one you are attempting to remove. if the movieclip you are trying to remove is named mc you could write
createEmptyMovieClip("new_empty_movieclip", mc.getDepth());
its a gross hack; but it works. i hope someone presents a better solution
expensive_pen
July 14th, 2005, 12:08 AM
i thought of a more elegant solution!
mc.swapDepths(getNextHighestDepth());
removeMovieClip(mc);
stringy
July 14th, 2005, 12:41 AM
i thought of a more elegant solution!
mc.swapDepths(getNextHighestDepth());
removeMovieClip(mc);
swapDepths() is the answer, but you need to swap to a positive depth.
i don`t use 2004 but i assume getNextHighestDepth() will not necessarily give that.
mc.swapDepths(999);
mc.removeMovieClip();
Smee
July 14th, 2005, 02:06 AM
Actually it does :)
MovieClip.getNextHighestDepth()
Availability
Flash Player 7.
Usage
my_mc.getNextHighestDepth() Parameters
None.
Returns
An integer that reflects the next available depth index that would render above all other objects on the same level and layer within my_mc.
Description
Method; lets you determine a depth value that you can pass to MovieClip.attachMovie() (http://12_ASD376.html#678192), MovieClip.duplicateMovieClip() (http://12_ASD385.html#240497), or MovieClip.createEmptyMovieClip() (http://12_ASD380.html#240323) to ensure that Flash renders the movie clip in front of all other objects on the same level and layer in the current movie clip. The value returned is 0 or higher (that is, negative numbers are not returned).
For more information, see Managing movie clip depths (http://../ActionScriptReference/07_movieclips14.html#122014).
See also
MovieClip.getDepth() (http://12_ASD394.html#240651), MovieClip.getInstanceAtDepth() (http://12_ASD395.html#1424318), MovieClip.swapDepths() (http://12_ASD445.html#241673)
Hint: The links don't work, I copied this from the help inside flash :P
Pissed_Peasant
July 14th, 2005, 10:19 PM
i thought of a more elegant solution!
ActionScript:
mc.swapDepths(getNextHighestDepth());
removeMovieClip(mc);
Yep that worked well. Thank you very much.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.