ENTER_FRAME Event Listener


Let's take a look at some classic coding shortcuts. Right now we have:

ball1.y = ball1.y+1;

Which is like saying: "Set the Y position of ball1 to the y position of ball1 plus 1." That can be confusing until you get accustomed to it! Don't get too caught up reading these equations from left to right. If we evaluate the right side of the equation first, we find we are asking Flash to lookup the value of ball1.y, which will return a number. Then we add 1 to that number.

Let's say ball1 is at (50,178). This is what Flash is doing real quick when it encounters our statement:

ball1.y = ball1.y+1
ball1.y = 178+1
ball1.y = 179

OK, let's check out a common programming shortcut to represent the same statement:


Yup, that works just fine, and it's exactly the way a real programmer would write it. Check out our Actions window now:

Now would be a good time to test your work...