Skip to main content
Participant
March 20, 2013
Answered

Whats the Action Script code (Using AS2) when you loop a scene once and then played again and stopin

  • March 20, 2013
  • 1 reply
  • 624 views

Whats the Action Script code (Using AS2) when you loop a scene once and then played again and stoping on a certain frame?

This topic has been closed for replies.
Correct answer Ned Murphy

You basically need to keep a count and use that as your stopping control.  In the first frame you need something to assign the value, but you don't want to reassign it a starting value, so you could use....

var count;

if(count == undefined){
    count = 0;
} else {
    count++;
}

Then, in the frame where you want to stop after one loop is completed you could have...

if(count == 1){

    stop();

}

1 reply

Ned Murphy
Ned MurphyCorrect answer
Legend
March 20, 2013

You basically need to keep a count and use that as your stopping control.  In the first frame you need something to assign the value, but you don't want to reassign it a starting value, so you could use....

var count;

if(count == undefined){
    count = 0;
} else {
    count++;
}

Then, in the frame where you want to stop after one loop is completed you could have...

if(count == 1){

    stop();

}