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.

■ If expression is undefined, the return value is as follows:<br />

- In files published for Flash Player 6 or earlier, the result is 0.<br />

- In files published for Flash Player 7 or later, the result is NaN.<br />

Parameters<br />

expression:Object - An expression to convert to a number. Numbers or strings that begin<br />

with 0x are interpreted as hexadecimal values. Numbers or strings that begin with 0 are<br />

interpreted as octal values.<br />

Returns<br />

Number - A number or NaN (not a number).<br />

Example<br />

In the following example, a text field is created on the Stage at runtime:<br />

this.createTextField("counter_txt", this.getNextHighestDepth(), 0, 0, 100,<br />

22);<br />

counter_txt.autoSize = true;<br />

counter_txt.text = 0;<br />

function incrementInterval():Void {<br />

var counter:Number = counter_txt.text;<br />

// Without the Number() function, Flash would concatenate the value instead<br />

// of adding values. You could also use "counter_txt.text++;"<br />

counter_txt.text = Number(counter) + 1;<br />

}<br />

var intervalID:Number = setInterval(incrementInterval, 1000);<br />

See also<br />

NaN constant, Number, parseInt function, parseFloat function<br />

Object function<br />

Object( [value] ) : Object<br />

Creates a new empty object or converts the specified number, string, or Boolean value to an<br />

object. This comm<strong>and</strong> is equivalent to creating an object using the Object constructor (see<br />

"Constructor for the Object class").<br />

Parameters<br />

value:Object [optional] - A number, string, or Boolean value.<br />

Global Functions 65

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

Saved successfully!

Ooh no, something went wrong!