Skip to main content
June 25, 2013
Question

How to create a loop in this case?

  • June 25, 2013
  • 1 reply
  • 297 views

Hi! I'm trying to use the if statement, but the code is only read once.
How do I get this code to be read several times?

For example, when the car passes the detector the number goes to 10.
So the code does not detect the if statement because the code is only read once.

Code:

var score: Number = 9;

if (score == 10)
{
gotoAndPlay (3);
}


This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
June 25, 2013

you could put that code in a function and use a loop (like enterframe to call it) or, even more efficent, call the function whenever score could be changed.