MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH Manual page 130

Learning actionscript 2.0 in flash
Table of Contents

Advertisement

Because of order of precedence, if you didn't use parentheses or use two separate statements,
the multiplication would be computed first, meaning that the first operation would be 20 *
0.8. The result, 16, would then be added to the current value of circleClip._x and finally
assigned to the
variable.
computedValue
If you don't use parentheses, you must add a statement to evaluate the expression, as shown in
the following example:
var tempValue:Number = circleClip._x + 20;
var computedValue:Number = tempValue * 0.8;
As with brackets and braces, you need to make sure each opening parentheses has a closing
parentheses.
About literals
A literal is a value that appears directly in your code. Literals are constant (unchanging) values
within your Flash documents. Examples of a literal include
,
,
,
,
, or even the
true
false
0
1
52
string
.
"foo"
The following examples are all literals:
17
"hello"
-3
9.4
null
undefined
true
false
Literals can also be grouped to form compound literals. Array literals are enclosed in bracket
punctuators (
) and use the comma punctuator (
) to separate array elements. An array
[]
,
literal can be used to initialize an array. The following examples show two arrays that are
initialized using array literals. You can use the
statement and pass the compound literal as
new
a parameter to the Array class constructor, but you can also assign literal values directly when
instantiating instances of any built-in ActionScript class.
// using new statement
var myStrings:Array = new Array("alpha", "beta", "gamma");
var myNums:Array = new Array(1, 2, 3, 5, 8);
// assigning literal directly
var myStrings:Array = ["alpha", "beta", "gamma"];
var myNums:Array = [1, 2, 3, 5, 8];
130
Syntax and Language Fundamentals

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash 8

Table of Contents