Description of ActionScript constants and global functions

Source: Internet
Author: User
● Constants and global functions ●

Note: If the = sign is added before the function name, the function returns a value.

1. constants:
True logical truth.
False logical false.
Null value, which can be equal to the undefined value (but of different types ). For example, if variable is not defined,
Variable = NULL is true.
Nan indicates not a number, which is a non-numerical value. Used to characterize non-numeric Errors During numerical calculation
Error. For example, 1 * 'A' requires Nan.
Newline indicates a linefeed, that is, '/N '.
Infinite indicates an infinite number. For example,-1/0-infinite.

2. Numeric functions:
= Number (expression)
Convert expression to a value. If expression is false, null, or undefined, 0 is returned,
If it is true, 1 is returned. If it cannot be converted, Nan is returned. For example, number ("12e2") returns 1200.
= Boolean (expression)
Converts an expression to a Boolean value. The expression value is false, null, "false", or
If it is a string and number (expression) is Nan or 0, false is returned; otherwise, true is returned.
= Int (expression)
Convert the expression into a number and then take the integer. For example, INT ("-1.2") returns-1.
= Random (Num)
Returns a random integer from 0 to a num-1 (Num must be a positive integer.
= Isfinite (expression)
Determine whether expression is limited after being converted to a value. For example, isfinite (1/0) returns
False.
= Isnan (expression)
Determines whether expression is a non-numeric value.
= Parseint (expression, num)
Convert 'expression' into a string first, and then convert it into an integer in num format. For example:
Parseint (12, 16) returns 18.
= Parsefloat (string)
Converts a string to a floating point number. For example, parsefloat ("1.2e-2") returns 0.012.

3. String operation functions:
= String (expression)
Convert expression into a string. The expression value can be a Boolean value, a value, or a common object.
(Return "[object] [object]"), array object (return the Value List of each item), and film
Segment (return absolute path ).
= CHR (Num)
Returns the corresponding character whose ASCII value is num.
= Ord (char)
Returns the ASCII code value (8-bit) corresponding to the character char ).
= Length (string)
Returns the string length (the number of characters ).
= Substring (string, start_num, length_num)
Returns the start_num (greater than or equal to 0) character in the string. The length is
Length_num (must be greater than or equal to 0, otherwise it is ignored. If length is omitted or exceeded, return
The entire substring after start_num.
= Mbchr (Num)
Returns the Double Byte Character corresponding to the ASCII code value of num.
= Mbord (char)
Returns the ASCII code value (16-bit) corresponding to the double-byte character char ).
= Ength (string)
Returns the double-byte length of string.
= Mbsubstring (string, start_num, length_num)
Returns the child string with the start character and length of length_num in string.
= Escape (string)
Translate a general string into a URL-encoded string. For example, escape ("1 & 2") returns "1% 262 ".
= Unescape (string)
Decodes a string in URL format into a general string. If unexcape ("% D7 % D4 % D4 % da") returns
Back to "free ".

Note: When a string is processed by double-byte characters, double-byte characters (such as Chinese characters) represent a whole. For example
String "I'm free Fantasy", returns 12 when used in the length function, and returns 8 when used in the ength function.

4. Other functions:
= Getproperty (MC, property)
Returns the property value of the film clip MC.
= Targetpath (MC)
Returns the absolute path string of the film clip MC. For example, a video clip in the main scenario is named mc1,
Targetpath (_ root. mc1) returns "_ level0.mc1 ".
= Eval (target)
Returns the variable, object, or video clip instance referenced by the target path string. Example above
Eval ("_ root. mc1") returns the mc1 object of the video clip.
= Gettimer ()
The interval (in milliseconds) from the start of video playback to the current time ).
= Getversion ()
Return to the system platform and Flash Player version. If "win 5, 0, 30, 0" is returned, it indicates the current
The system is windows, and the Flash Player version is 5.0r30.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.