Curly braces
ActionScript event handlers, class definitions, and functions are grouped together into blocks
with curly braces (
the next line, as shown in the following examples. To make your code easier to read, it's a good
idea to choose one format and use it consistently.
// Event handler
on(release) {
myDate = new Date();
currentMonth = myDate.getMonth();
}
on(release)
{
myDate = new Date();
currentMonth = myDate.getMonth();
}
// Class
class Circle(radius) {
}
class Square(side)
{
}
// Function
circleArea = function(radius) {
return radius * radius * MATH.PI;
}
squareArea = function(side)
{
return side * side;
}
You can check for matching curly braces in your scripts; see
on page
66.
Semicolons
An ActionScript statement is terminated with a semicolon (
var column = passedDate.getDay();
var row
= 0;
If you omit the terminating semicolon, Flash still compiles your script successfully. However,
using semicolons is good scripting practice.
). You can put the opening brace on the same line as your declaration or on
{}
"Checking syntax and punctuation"
), as shown in these examples:
;
Syntax
31
Need help?
Do you have a question about the FLASH MX 2004 - ACTIONSCRIPT and is the answer not in the manual?