Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 80307

If statement not working for some reason

$
0
0

In a scene for one of my animations, I have the following --

 

if(a == 3)

{

  a = 0;

  gotoAndPlay(1,"Scene 4");

}

else

{

  gotoAndPlay(1,"Scene 3");

}

 

 

if(clicked2)

{

  gotoAndPlay(1,"Scene 5");

}

else

{

  gotoAndPlay(1,"Scene 3");

}

 

I have the variable declared in a previous scene, and it was working at first.  It doesn't give me an error, but the A Variable seems to not do anything (It doesn't go to the next scene, even if it is equal to 3)

 

This is the line of code in the frame beforehand --

 

var clicked2:Boolean = false;

 

 

button2.addEventListener(MouseEvent.CLICK, goScene2);

function goScene2(event:MouseEvent):void {

  clicked2 = true;

}

 

 

a++;

 

Thanks in advance!


Viewing all articles
Browse latest Browse all 80307

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>