M.Vekaria
M.Vekaria

Reputation: 1

How to fix AS3 button?

I have a problem with my puzzle game as there is an image which appears when a button is pressed. The continue button should go to the next puzzle but it only works when the image is on the screen and when it's not on screen the button does not work.

This is the code for the continue button:

continuelvl3.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_23);

function fl_ClickToGoToAndStopAtFrame_24(event:MouseEvent):void
{
    removeChild(Elsa);  
    gotoAndStop(15);
}

Upvotes: 0

Views: 30

Answers (1)

Sameer Kumar Jain
Sameer Kumar Jain

Reputation: 2135

Perhaps you need to check if your image exist, so something like this

function fl_ClickToGoToAndStopAtFrame_24(event:MouseEvent):void
{
    if(this.contains(Elsa))removeChild(Elsa);  
    gotoAndStop(15);
}

Upvotes: 1

Related Questions