0
votes

I have just a movieClip green ball on my main timeline, inside of this movie clip, i have 2 frames, the first one with the normal green ball, the other one with a bigger green ball and a "Back" movieclip button (both with a Stop();), a just can't make the back button, gotoAndStop on the frame 1, where the green ball movieclip is small.

Main timeline code:

stop();

greenball.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler);

function fl_MouseClickHandler(event:MouseEvent):void
{

greenball.gotoAndStop(2); //frame 2 where the ball is bigger

}

On greenball movieclip frame 1 i just have a stop();

On frame 2, a big greenball and a "back" movieclip button:

stop();

back.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_4);

function fl_MouseClickHandler_4(event:MouseEvent):void
{

gotoAndStop(1);
trace ("Back to 1");
}

The trace shows "Back to 1", but the ball don't go back to be small, the big ball does not exist on frame 1 as I used to do on ACS2.

What can I do?

3

3 Answers

0
votes

Thanks for the answer, but in this case, i'm not using the "Back" button.

0
votes

You should probably use the following code

greenball.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler);

function fl_MouseClickHandler(event:MouseEvent):void
{
    if(greenball.currentFrame == 1) {
        greenball.gotoAndStop(2);
    }
    if(greenball.currentFrame == 2) {
        greenball.gotoAndStop(1);
    }
}
0
votes

i think this will work for you but u need to put the back button in the main timeline and make it invisible (it's instance name will be backBtn)

greenball.addEventListener(MouseEvent.CLICK, showBigBall);
backBtn.addEventListener(MouseEvent.CLICK, showSmallBall);
function showBigBall(event:MouseEvent):void
{
 greenball.gotoAndStop(2);
backBtn.visible = true;
}
function showSmallBall(event:MouseEvent):void
{
 greenball.gotoAndStop(1);
backBtn.visible = false;
}