Skip to main content
September 28, 2014
Answered

Action when mc is empty

  • September 28, 2014
  • 17 replies
  • 1460 views

Hello

I have 4 objects inside movie clip each one with code on it's the 2nd frame tile.visible = false;. To refer to that frame 2 from the main timeline I have "cont.tile1.addEventListener(MouseEvent.CLICK, fr2); function fr2(event:MouseEvent):void { tile1.gotoAndStop(2); }" This code 1 time for each tile(renamed). The objects( tiles) are inside mc called "cont". Once they are all clicked and are invisible I need to take action like for example to go to frame 5 on the main timeline.How can i make that possible?. Thanks.

This topic is closed to new replies. Start a new post to keep the conversation going.
Correct answer Ned Murphy

Keep track of how many you click in the main timeline and when all are clicked just issue the command.

You could use one function instead of having a function for each tile....

var clickedCount:int = 0;

function f(event:MouseEvent):void {

     MovieClip(event.currentTarget).gotoAndStop(2);

     clickedCount ++;

     if(clickedCount == 4){

         gotoAndStop(5);

     }

}

17 replies

Ned Murphy
Ned MurphyCorrect answer
Legend
September 28, 2014

Keep track of how many you click in the main timeline and when all are clicked just issue the command.

You could use one function instead of having a function for each tile....

var clickedCount:int = 0;

function f(event:MouseEvent):void {

     MovieClip(event.currentTarget).gotoAndStop(2);

     clickedCount ++;

     if(clickedCount == 4){

         gotoAndStop(5);

     }

}

September 30, 2014

Thank you for your answer

My knowledge limitations are not allowing me such luxuries as to write 1 code instead of 4, I don't understand how do you refer inside the tile mc inside the container.  There are 4 tiles each one with separate instance name. If you can just tell me how to go to frame 5 in the given configuration would be great. :Newtest.fla - Box.

Ned Murphy
Legend
September 30, 2014

The code I provided already does that.  You just need to add event listeners like you already did, changing them to call the function "f" that I showed instead of the function(s) you have.