Semicolons


You've probably noticed that all our ActionScript statements thus far have ended with a semicolon. Semicolons are the way you tell Flash that a statement is over, similar to a period in English. Nearly all statements in ActionScript should end in a semicolon. There are exceptions, but we'll get to those later. Many times, if you forget the semicolon, Flash reports a syntax error during testing to tell you about your missing semicolon. This is not always the case, however; sometimes Flash lets you get away with omitting one. You should become disciplined about putting a semicolon everywhere that's appropriate. Look at it this way: Semicolons are required in Java, C++, and C, and they are required in most places in JavaScript and ActionScript, so getting in the habit of using them isn't the worst thing in the world.

Tip  

You can use the Auto Format option in the Actions panel (it's in the menu along with Normal and Expert mode settings) to correct your indention and add semicolons to your script.




Macromedia Flash MX 2004 Game Programming
Macromedia Flash MX 2004 Game Programming (Premier Press Game Development)
ISBN: 1592000363
EAN: 2147483647
Year: 2004
Pages: 161

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net