About syntax, statements, and expressions
115
Expressions
, different from statements, are any legal combination of ActionScript symbols that
represent a value. Expressions have
values
, while values and properties have
types
. An
expression can consist of operators and operands, values, functions, and procedures. The
expression follows ActionScript rules of precedence and of association. Typically, Flash Player
interprets the expression and then returns a value that you can use in your application.
For example, the following code is an expression:
x + 2
In the previous expression,
x
and
2
are operands and
+
is an operator. For more information
on operators and operands, see
“About operators” on page 176
. For more information on
objects and properties, see
“Object data type” on page 78
.
The way you format your ActionScript also determines how maintainable your code is. For
example, it’s difficult to read the logic of a FLA file that doesn’t contain indents or comments,
or contains inconsistent formatting and naming conventions. When you indent blocks of
ActionScript (such as loops and
if
statements), the code is easier to read and debug if you
encounter problems. For more information about formatting ActionScript, see
“Formatting
ActionScript syntax” on page 764
. You can also see proper formatting of ActionScript in
these sections.
For more information on syntax and language fundamentals, see the following topics:
■
“Differences between ActionScript and JavaScript”
■
“About case sensitivity”
Differences between ActionScript and JavaScript
ActionScript is similar to the core JavaScript programming language. You don’t need to know
JavaScript to use and learn ActionScript; however, if you know JavaScript, ActionScript will
seem familiar.
This manual does not attempt to teach general programming. There are many resources that
provide more information about general programming concepts and the JavaScript language.
■
The ECMAScript (ECMA-262) edition 3 language specification is derived from
JavaScript and serves as the international standard for the JavaScript language.
ActionScript is based on this specification. For more information, see
www.ecma-
international.org/publications/standards/Ecma-262.htm
.
■
The Java Technology site has tutorials on object-oriented programming (
http://
java.sun.com/docs/books/tutorial/java/index.html
) that are targeted for the Java language
but are useful for understanding concepts that you can apply to ActionScript.
Содержание FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
Страница 1: ...Learning ActionScript 2 0 in Flash...
Страница 8: ...8 Contents...
Страница 18: ...18 Introduction...
Страница 30: ...30 What s New in Flash 8 ActionScript...
Страница 66: ...66 Writing and Editing ActionScript 2 0...
Страница 328: ...328 Interfaces...
Страница 350: ...350 Handling Events...
Страница 590: ...590 Creating Interaction with ActionScript...
Страница 710: ...710 Understanding Security...
Страница 730: ...730 Debugging Applications...
Страница 780: ...780 Deprecated Flash 4 operators...
Страница 830: ...830 Index...