MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference page 238

Actionscript 2.0 language reference
Table of Contents

Advertisement

The following code snippet shows how to write the preceding code without using a
statement.
someOther_mc._x = 50;
someOther_mc._y = 100;
someOther_mc.gotoAndStop(3);
The
statement is useful for accessing multiple items in a scope chain list simultaneously.
with
In the following example, the built-in
Setting
as a default object resolves the identifiers
Math
, and
Math.sin
Math.PI
properties of the
Math
function
, they resolve to the corresponding local variables.
polar()
function polar(r:Number):Void {
var a:Number, x:Number, y:Number;
with (Math) {
a = PI * pow(r, 2);
x = r * cos(PI);
y = r * sin(PI / 2);
}
trace("area = " + a);
trace("x = " + x);
trace("y = " + y);
} polar(3);
The following result is displayed in the Output panel.
area = 28.2743338823081
x = -3
y = 3
238
ActionScript language elements
Math
, respectively. The identifiers
object, but because they exist in the object activation scope of the
object is placed at the front of the scope chain.
,
, and
cos
sin
,
,
, and
a
x
y
with
to
,
PI
Math.cos
are not methods or
r

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash 8

Table of Contents

Save PDF