0
votes

i'm following this tutorial http://workflowflash.com/3901/hiding-movie-clips-in-as3.php for hide and show movie clips, but i want to hide and show multiple movie clips using one button.

i'm making a simple animation(movie clips) with bubbles text(movie clip). so i want to hide all bubble text when i click disable dialog button. - hide movie clips inside a movie clip. should i use array?

i'm really new to this, so i hope someone can help me and i really appreciate it. :)

1

1 Answers

1
votes

Sure, you can use array, but is it a best way - it depends on many things.

Maybe try something like that:

var myArray:Array = [myMoveclip1, myMoveclip2, myMoveclip3];

switchBtn.addEventListener(MouseEvent.CLICK, _switch);

private function _switch(e:MouseEvent) : void {
    for each(var item:MovieClip in myArray) {
        item.visible = !item.visible; // or just "item.visible = false;" to only hide
    }
}

Now your button will be hiding and showing MovieClips from array, but I'm not sure if that is what you expect/need.