Set x,y Coordinates with ActionScript

The Compiler Errors Window

Let's modify that code... we'll keep setting the x position of ball1 and ball2, but let's try changing the y position of ball3 (don't worry that ball3 doesn't "exist" yet):

Now test:

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player

What? Nothing is right! The whole program failed! Why? You'll get a hint of what's happening if you look at the Compiler Errors window:

You've created an error, and the Compiler tells you exactly where to locate the offending line of code: Scene 1, Layer 'actions', Frame 1, Line 3

OK, so right now you might be thinking "duh, I knew that". But can you see where this might come in handy at some point in the future? Imagine you've worked for several days, creating hundreds of lines of code, and suddenly everything has come to a standstill. The Compiler Errors window is your friend!

Wait, what is a compiler anyway? A compiler translates source code from complex programming languages (like ActionScript) to a file that can be run directly by a computer. If there are any errors in the code, the compiler won't be able to compile it.

OK, go back and Undo that last statement! Go back to the way we were: