Conditional Statement:

Conditional Statements are used to check if certain conditions are true. If true, a block of code will be executed. If false, the block of code will be skipped. You can do many things with conditional statements. One thing would be to build a simple counter to control how many times your movie loops.

In the 1st frame of your movie set a variable equal to the number of loops you want:

totalLoops = 5;

In the last frame of your movie increment a counter variable and use a conditional statement to check if your counter is equal to the total number of loops desired.

counter = counter + 1; // this adds 1 to your counter variable

if (counter == totalLoops) {
     stop();
}
this "if" statement compares the current value of your counter variable to the value held in the totalLoops variable. If they are equal, the animation is instructed to stop. Otherwise it keeps looping.

*Note - the double equal sign (==) is important in this statement:

counter = totalLoops; // this line says, "Set counter equal to the value of totalLoops."
You can think of it as a Statement.

counter == totalLoops; // this line asks, "Is counter equal to totalLoops?"
You can think of it as a Question.