|
-
[F8] removeMovieClip() in this script isn't working
I have absolutely no idea why the following code isn't working. I've checked the documentation for removeMovieClip at least a dozen times. The only thing I've noticed is the following:
Method; removes a movie clip instance created with duplicateMovieClip(), MovieClip.duplicateMovieClip(), or MovieClip.attachMovie().
As you will notice, I'm using createEmptyMovieClip() - not one of the methods mentioned - but I swear I've used removeMovieClip to delete movieclips created this way before and it's worked fine. I can't find an alternative command, either.
Here is my code. When I trace white in the onRollOut function, it returns the correct path, so it's not a targetting issue. I've also tried adjusting one of the movieclip white's properties (alpha) and it's worked fine.
Code:
planet.onRollOver = function(){
var over:MovieClip = createEmptyMovieClip("white",this.getDepth()-1);
//other events
}
planet.onRollOut = function(){
white.removeMovieClip(); //trace here returns proper path
}
Any ideas as to why this command isn't working would be great.
-
Flashmatics
removeMovieClip() can remove ANY movie clip as long as the depth of the movie clip is POSITIVE AND LESS THAN 1,048,575
Movieclips that are made during author time can hence be removed by first making them positive and then using the removeClipMethod()
Hence ANY movieclip mcHolder (dynamic or authortime) can be removed
mcHolder.swapDepths(_root.getNextHighestDepth()):
mcHolder.removeMovieClip();
However if you use components sometimes elements are placed at a depth greater than 1,048,575, hence it cant be removed unless you lower the depth.
So check the depth of the movieclip and if its higher than 1,048,575 first lower it to a lower depth and then try rmeoving it. so basically u can use something like:
Code:
if(mcHolder.getDepth() >= 1048575 || mcHolder.getDepth() <= 0 ){
mcHolder.swapDepths(2000);
}
mcHolder.removeMovieClip();
-
Hey, silentweed.
Thanks for that information. May I ask where you found it? It wasn't in any of documentation I read.
-
Silentweed, I know this is a couple of years after the fact - just wanted to say thanks for posting that solution; it worked like a charm and saved me a lot of grief. Thanks again!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|