03.05.2013 Views

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

gotoAndStop(3);<br />

}<br />

The following code snippet shows how to write the preceding code without using a with<br />

statement.<br />

someOther_mc._x = 50;<br />

someOther_mc._y = 100;<br />

someOther_mc.gotoAndStop(3);<br />

The with statement is useful for accessing multiple items in a scope chain list simultaneously.<br />

In the following example, the built-in Math object is placed at the front of the scope chain.<br />

Setting Math as a default object resolves the identifiers cos, sin, <strong>and</strong> PI to Math.cos,<br />

Math.sin, <strong>and</strong> Math.PI, respectively. The identifiers a, x, y, <strong>and</strong> r are not methods or<br />

properties of the Math object, but because they exist in the object activation scope of the<br />

function polar(), they resolve to the corresponding local variables.<br />

function polar(r:Number):Void {<br />

var a:Number, x:Number, y:Number;<br />

with (Math) {<br />

a = PI * pow(r, 2);<br />

x = r * cos(PI);<br />

y = r * sin(PI / 2);<br />

}<br />

trace("area = " + a);<br />

trace("x = " + x);<br />

trace("y = " + y);<br />

} polar(3);<br />

The following result is displayed in the Output panel.<br />

area = 28.2743338823081<br />

x = -3<br />

y = 3<br />

fscomm<strong>and</strong>2 Comm<strong>and</strong>s<br />

The following comm<strong>and</strong>s are available for the fscomm<strong>and</strong>2() function. For a description of<br />

the fscomm<strong>and</strong>2() function, see fscomm<strong>and</strong>2 Function under "Global Functions."<br />

fscomm<strong>and</strong>2 Comm<strong>and</strong>s<br />

Comm<strong>and</strong> Description<br />

ExtendBacklightDura Extends the duration of a backlight for a specified period of time.<br />

tion<br />

FullScreen Sets the size of the display area to be used for rendering.<br />

GetBatteryLevel Returns the current battery level.<br />

fscomm<strong>and</strong>2 Comm<strong>and</strong>s 209

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!