PDA

View Full Version : removeMovieClip ... REMOVE!!!!!


gonda
10-09-2003, 06:03 AM
Okeej,

I have a problem. I have my main stage. On my main stage I have 4 MC's as buttons. In those MC's I say :



this.onRollOver = function () {
gotoAndPlay("over");
}

this.onRollOut = function () {
gotoAndPlay("out");
}



this.onRelease = function () {

createEmptyMovieClip("externalMovie",20);
externalMovie.loadMovie("balk.swf");

this.gotoAndPlay("press");
this.enabled = false;
if(prevClip != this) {
prevClip.enabled = true;
prevClip.prevFrame();
prevClip.gotoAndPlay("back");
_global.prevClip = this;
}


//externalMovie._x = 100;
//externalMovie._y = 400;


}


stop();



Now I want the "externalMovie" I create when I click the button to disappear when I click another button (MC). I tried

externalMovie.removeMovieClip();

in the onRelease function but that won't work.

Can somebody help me?

I use :

createEmptyMovieClip("externalMovie",20);
externalMovie.loadMovie("balk.swf");

in every MC, only the loaded swf changes. I already tried using different MCnames for externalMovie or changing the depth but that won't change anything...

junahu
10-09-2003, 06:35 AM
I've read in Flash's help (mx) that removemovieclip only works for movieclips created via duplicatemovieclip or attachmovieclip.

gonda
10-09-2003, 06:43 AM
But this is what I read here on the forum :

Originally posted by 20 Ton Squirrel
I've used the method version of removeMovieClip on attached and duped clips as well as clips created using createEmptyMovieClip(). For instance:


_root.createEmptyMovieClip("mov_empty", 10);
trace(mov_empty._name);


You'll trace it's name, which means it was created.

Now try this:

_root.createEmptyMovieClip("mov_empty", 10);
mov_empty.removeMovieClip();
trace(mov_empty._name);

You'll get undefined, which means that the clip was devoured by Cthulu, He Who Lurketh Behind Your Monitor. Go on, leave him some peanuts!

The same methodology can be applied to your attached clippiethings, it works there too. Experiment and see!


hmmm ... :(

junahu
10-09-2003, 06:45 AM
hmmm?

webguy
10-09-2003, 01:47 PM
Originally posted by junahu
I've read in Flash's help (mx) that removemovieclip only works for movieclips created via duplicatemovieclip or attachmovieclip.

20 ton squirrel and junahu are correct. They are both saying the same thing. Only dynamically created movieClips can be removed using removeMovieClip(). (ie those created using createEmptyMovieClip(); duplicateMovieClip(); attachMovie(); loadMovie(); and loadMovieNum(); ) Though you are using it correctly I would double check your references to the clips. You do realize that using createEmptyMovieClip() the way that you are creates it in the scope of the button you have that code on. Perhaps _root.createEmptyMovieClip() is in order.

I often pass this on as it works really well for removing movieClips. It is a prototype I got from proto.layer51.com that was written by senocular. Very simple and also easy to use.



MovieClip.prototype.remove = function(){
this.swapDepths(1048575);
this.removeMovieClip();
}

// use like this
myMc.remove();



[PS]
I stalk around threads
And say stupid things often
I am annoying

(snigger)

I think you mean (snicker), or maybe not :(

webG