Notes to Lesson 8a

You can cut down on code somewhat by putting the movement inside a php loop:

for($i=0; $i<13; $i++){
$myMovie->nextFrame();
$movingSquare->move(40,0);
}

The above loop replaces all of the lines of movement. There were 12 instances of moving the square (40,0). The above loop repeats the code within the loop 12 times, adding 1 number at a time. The $i in the loop indicates an integer, but you can easily substitute any variable for $i.

Below is the php code for the same lesson using the loop.