Ultrashock Forums > Flash > ActionScript
Discovery about removeMovieClip()!!!
Member Blogs
 
Post Reply | View first unread | Rate Thread Search this Thread | Thread Tools | Display Modes

#1
Bookmark and Share!
Discovery about removeMovieClip()!!!
Old 2006-01-13

I have accidently discovered how to remove ANY movieclip regardless wether it is manually added to the stage, or dynamically (with attachMovie, or duplicateMovieClip, or createEmptyMovieClip)

OK, create a new flash document, create one movieclip in the library, and drag 2 instances of it onto the stage, naming one myClip1 and the other myClip2

Then paste this code on your timeline:

ActionScript Code:
  1. myClip1.removeMovieClip();
  2. myClip2.swapDepths(5);
  3. myClip2.removeMovieClip();

Viola! myClip2 has buggered off! Not even a sniffter of it in the 'List Objects' of the output pane!!
If it moves, eat it. If it doesn't move, wait till it moves, then eat it.
postbit arrow 6 comments | 271 views postbit arrow Reply: with Quote   
David_King
Registered User
David_King is offline
seperator
Posts: 1,626
2004-07-22
Age: 24
seperator

Ultrashock Member Comments:
fs123456 fs123456 is offline 2006-01-13 #2 Old  
WTF! I thought that would be obvious
Reply With Quote  
David_King David_King is offline 2006-01-13 #3 Old  
Hmm, I dont know if your having a go at me, or at the flash player..?

The point is, that without the swapDepths the removeMovieClip() fails. It has never been obvious to me to call swapDepths first in order to trick the player. I figure it may have slipped past other actionscripters.

Reply With Quote  
senocular senocular is offline Moderator senocular lives in United States 2006-01-13 #4 Old  
its not so much -without- swapdepths; its just a matter of having a movie clip in a depth between 0 and 1048575. By default, movie clips placed on the timeline are in negative depths (which is where swapdepths comes in to change that for removal if needed)

http://senocular.com/flash/tutorials/depths/?page=2
Reply With Quote  
David_King David_King is offline 2006-01-13 #5 Old  
ahh, thanks senocular, I have never really understood where those pesky movieclips went.
Reply With Quote  
ClydeMK ClydeMK is offline 2007-06-25 #6 Old  
You guys just stopped me from losing my hair early.

This has been driving me mad for days! :-)
Reply With Quote  
uxk8396 uxk8396 is offline 2008-07-08 #7 Old  
Hi,
sub: RemoveMovieClip() using AS2

Here is my function from the frame 1.
function fillRegion(x0, y0, x1, y1, d) {
// pick one of the words and place
n = random(wordList.length);
word = wordList[n];
// place the word object
nombre = "word"+String(depth++);
neo = this.attachMovie("mcWord", lettre, depth);
// set word
neo.setWord(word);
neo.fitInto(x0,y0,x1,y1,d);
I need to remove the dynamic movieClip in frame 2.
this.onEnterFrame=function(){

lettre.swapDepths(8000)
lettre.removeMovieClip()
}
It does not work. Any suggestion.
Thank you
Reply With Quote  
Thread Tools
Display Modes Rate This Thread
Rate This Thread: