Search code examples
flashactionscript

Actionscript 2.0 Movie clip


I am using an ActionScript 2.0 for my project. I have a movie clip named ant_mc. My problem is, the movie clip "ant" is just hidden and its not totally disappeared or remove. this is my code to hide the movie clip.

var keyListener:Object = new Object();
keyListener.onKeyDown = function() {

if (textbox.text == "ant"){
ant_mc._visible = false;

}

i want ant_mc to disappear permanently.


Solution

  • If you create the movie clip with ActionScript, just call the removeMovieClip method.

    ant_mc.removeMovieClip();
    

    However, if you create the movie clip in the editor, then you will need to use the swapDepths method first.

    ant_mc.swapDepths(0);
    ant_mc.removeMovieClip();