Number( ) Global Function

ActionScript for Flash MX: The Definitive Guide, 2nd Edition
By Colin Moock
Chapter 18.  ActionScript Language Reference
Number( ) Global Function Flash 5

convert a value to the Number datatype
Number(value)

Arguments

value

An expression containing the value to be converted to a number.

Returns

The result of converting value to a primitive number.

Description

The Number( ) function converts its value argument to a primitive numeric value and returns that converted value. The results of converting various types of data to primitive numbers are described in Table 3-1 in Chapter 3. It's rarely necessary to use the Number( ) function; ActionScript automatically converts values to the number type when appropriate.

Be sure not to confuse the global Number( ) function with the Number class constructor. The former is a function that converts a value to the number type, whereas the latter is the class used to wrap a primitive numeric datum in an object that can take properties and methods.

Usage

Note that the Number( ) function frequently appears in Flash 4 .fla files that have been converted to the Flash 5 format. For information on how datatypes are handled when Flash 4 files are converted to Flash 5, see Section C.3.4.

See Also

The Number class, parseFloat( ), parseInt( ); Section 3.4.2



    ActionScript for Flash MX. The Definitive Guide
    ActionScript for Flash MX: The Definitive Guide, Second Edition
    ISBN: 059600396X
    EAN: 2147483647
    Year: 2002
    Pages: 780
    Authors: Colin Moock

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net