/**************************************************************************** * * ADOBE CONFIDENTIAL * ___________________ * * Copyright [2002] - [2006] Adobe Macromedia Software LLC and its licensors * All Rights Reserved. * * NOTICE: All information contained herein is, and remains the property * of Adobe Macromedia Software LLC and its licensors, if any. * The intellectual and technical concepts contained herein are proprietary * to Adobe Macromedia Software LLC and its licensors and may be covered by * U.S. and Foreign Patents, patents in process, and are protected by trade * secret or copyright law. Dissemination of this information or reproduction * of this material is strictly forbidden unless prior written permission is * obtained from Adobe Macromedia Software LLC and its licensors. ****************************************************************************/ package { //**************************************************************************** // ActionScript Standard Library // ArgumentError object //**************************************************************************** /** * The ArgumentError class represents an error that occurs when the arguments * supplied in a function do not match the arguments defined for * that function. Possible sources of this error include a function being called with * the wrong number of arguments, an argument of the incorrect type, or an argument that is * invalid. * * @tiptext An ArgumentError is thrown when the parameter values supplied during a * function call do not match the parameters defined for that function. * * @includeExample examples\ArgumentErrorExample.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword Error */ public dynamic class ArgumentError extends Error { /** * Creates an ArgumentError object. * @param message A string associated with the error. */ public native function ArgumentError(message:String = ""); } } package { /** * An arguments object is used to store and access a function's arguments. * While inside the function's body it can be accessed with the local arguments * variable. *

* The arguments are stored as array elements, the first is accessed as * arguments[0], the second as arguments[1], etc. The * arguments.length property indicates the number of arguments passed to * the function. Note that there may be a different number of arguments passed in than * the function declares. *

*

* ActionScript 3.0 has no arguments.caller property, which did exist in previous versions of * ActionScript. To get a reference to the function * that called the current function, you must pass a reference to that function as an * argument. An example of this technique can be found in the example for arguments.callee. *

*

ActionScript 3.0 supports a new ...(rest) statement that is recommended instead of the * arguments class.

* * @tiptext An arguments object is used to store and access a function's arguments. * @playerversion Flash 8 * @langversion 3.0 * * @includeExample examples\ArgumentsExample.as -noswf * @see statements.html#..._(rest)_parameter ...(rest) statement * @see Function */ public class arguments { /** * A reference to the currently executing function. * * @includeExample examples\arguments.callee.1.as -noswf * @tiptext A reference to the currently executing function. * @playerversion Flash 8 * @langversion 3.0 */ public var callee:Function; /** * The number of arguments passed to the function. This may be more or less * than the function declares. * * @tiptext The number of parameters passed to the function. * @playerversion Flash 8 * @langversion 3.0 */ public var length:Number; } } package { //**************************************************************************** // ActionScript Standard Library // Array object //**************************************************************************** /** * The Array class lets you access and manipulate arrays. Array indices are zero-based, which means that the first element in the array is [0], the second element is [1], and so on. To create an Array object, you use the new Array() constructor . Array() can also be * invoked as a function. And, you can use the array access ([]) operator to initialize an array or access the elements of an array. *

You can store a wide variety of data types in an array element, including numbers, strings, objects, and even other arrays. You can create a multidimensional array by creating an indexed array and assigning to each of its elements a different indexed array. Such an array is considered multidimensional because it can be used to represent data in a table.

*

Arrays are sparse arrays meaning there may be an element at index 0 and another at index 5, but nothing in the index positions between those two elements. In such a case, the elements in positions 1 through 4 are undefined, which indicates the absence of an element, not necessarily the presence of an element with the value undefined.

* *

Array assignment is by reference rather than by value. When you assign one array variable to another array variable, both refer to the same array:

* * var oneArray:Array = new Array("a", "b", "c"); * var twoArray:Array = oneArray; // Both array variables refer to the same array. * twoArray[0] = "z"; * trace(oneArray); // Output: z,b,c. * *

The Array class should not be used to create associative arrays, which are different data structures that contain named elements instead of numbered elements. You should use the Object class to create associative arrays (also called hashes). Although ActionScript permits you to create associative arrays using the Array class, you cannot use any of the Array class methods or properties.

*

You can subclass Array and override or add methods. However, you must specify the subclass as dynamic * or you will lose the ability to store data in an array.

* * @tiptext Lets you access and manipulate indexed arrays. * * @playerversion Flash 9 * @langversion 3.0 * * @includeExample examples\ArrayExample.as -noswf * * @oldexample In the following example, my_array contains four months of the year: *
 * var my_array:Array = new Array();
 * my_array[0] = "January";
 * my_array[1] = "February";
 * my_array[2] = "March";
 * my_array[3] = "April";
 * 
* @helpid x208A1 * @refpath Objects/Core/Array * @keyword Array, Array object, built-in class * * @see operators.html#array_access [] (array access) * @see Object Object class */ public dynamic class Array { /** * Specifies case-insensitive sorting for the Array class sorting methods. You can use this constant * for the options parameter in the sort() or sortOn() method. *

The value of this constant is 1.

* @see Array#sort() * @see Array#sortOn() * @helpid x217F6 */ public static const CASEINSENSITIVE:uint = 1; /** * Specifies descending sorting for the Array class sorting methods. * You can use this constant for the options parameter in the sort() * or sortOn() method. *

The value of this constant is 2.

* * @see Array#sort() * @see Array#sortOn() * @helpid x217F7 */ public static const DESCENDING:uint = 2; /** * Specifies numeric (instead of character-string) sorting for the Array class sorting methods. * Including this constant in the options * parameter causes the sort() and sortOn() methods * to sort numbers as numeric values, not as strings of numeric characters. * Without the NUMERIC constant, sorting treats each array element as a * character string and produces the results in Unicode order. * *

For example, given the array of values [2005, 7, 35], if the NUMERIC * constant is not included in the options parameter, the * sorted array is [2005, 35, 7], but if the NUMERIC constant is included, * the sorted array is [7, 35, 2005].

* *

This constant applies only to numbers in the array; it does * not apply to strings that contain numeric data such as ["23", "5"].

* *

The value of this constant is 16.

* @see Array#sort() * @see Array#sortOn() * @helpid x217F8 */ public static const NUMERIC:uint = 16; /** * Specifies that a sort returns an array that consists of array indices as a result of calling * the sort() or sortOn() method. You can use this constant * for the options parameter in the sort() or sortOn() * method, so you have access to multiple views on the array elements while the original array is unmodified. *

The value of this constant is 8.

* @see Array#sort() * @see Array#sortOn() * @helpid x217F9 */ public static const RETURNINDEXEDARRAY:uint = 8; /** * Specifies the unique sorting requirement for the Array class sorting methods. * You can use this constant for the options parameter in the sort() or sortOn() * method. The unique sorting option terminates the sort if any two elements * or fields being sorted have identical values. *

The value of this constant is 4.

* @see Array#sort() * @see Array#sortOn() * @helpid x217FA */ public static const UNIQUESORT:uint = 4; [Inspectable(environment="none")] /** * A non-negative integer specifying the number of elements in the array. This property is automatically updated when new elements are added to the array. When you assign a value to an array element (for example, my_array[index] = value), if index is a number, and index+1 is greater than the length property, the length property is updated to index+1. *

Note: If you assign a value to the length property that is shorter than the existing length, the array will be truncated.

* * @playerversion Flash 9 * @langversion 3.0 * * @includeExample examples\Array.length.1.as -noswf * * @helpid x2089F * @refpath Objects/Core/Array/Properties/length * @keyword array.length, length */ public native function get length():uint; public native function set length(newLength:uint); /** * Lets you create an array of the specified length. * If you don't specify any parameters, an array with a length of 0 is created. * If you specify a length, an array is created with length number of elements. *

Note: This class shows two constructor method entries because the constructor accepts * variable types of arguments. The constructor behaves differently depending on the type and number of * arguments passed, as detailed in each entry. ActionSript 3.0 does not support method or constructor overloading.

* * * @playerversion Flash 9 * @langversion 3.0 * * @param numElements An integer that specifies the number of elements in the array. * * @throws RangeError If the sole argument is a number that is not an integer greater than or equal to zero. * @includeExample examples\Array.1.as -noswf * @includeExample examples\Array.2.as -noswf * * @see operators.html#array_access [] array access * @see #length Array.length * */ public native function Array(numElements:int = 0); /** * Lets you create an array containing the specified elements. * The values specified can be of any type. * The first element in an array always has an index or position of 0. *

Note: This class shows two constructor method entries because the constructor accepts * variable types of arguments. The constructor behaves differently depending on the type and number of * arguments passed, as detailed in each entry. ActionSript 3.0 does not support method or constructor overloading.

* @param ...values A comma-separated list of one or more arbitrary values. *

Note: If only a single numeric parameter is passed to the Array constructor, * it is assumed to specify the array's length property.

* @throws RangeError If the sole argument is a number that is not an integer greater than or equal to zero. * @includeExample examples\Array.3.as -noswf * @see operators.html#array_access [] array access * @see #length Array.length */ public native function Array(...values); /** * Concatenates the elements specified in the parameters with the elements in an array and creates a new array. If the parameters specify an array, the elements of that array are concatenated. * * @tiptext Concatenates the elements specified in the parameters. * * @playerversion Flash 9 * @langversion 3.0 * * @param ...args A value of any data type (such as numbers, elements, or strings) to be concatenated in a new array. If you don't * pass any values, the new array is a duplicate of the original array. * * @return An array that contains the elements from this array followed by elements from * the parameters. * * @includeExample examples\Array.concat.1.as -noswf * * @helpid x2089D * @refpath Objects/Core/Array/Methods/concat * @keyword array.concat, concat, concatenate */ public native function concat(...args):Array; /** * Executes a test function on each item in the array until an item is reached that returns false for the specified function. You use this method to find out if all items in an array meet a certain criterion; for example, they all have values less than some number). *

For this method, the second parameter, thisObject, must be null if the * first parameter, callback, is a method closure. In other words, if you create a function in a movie clip * called me:

*
     * function myFunction(){
     *    //your code here
     * }
     * 
*

and then use the filter method on an array called myArray:

*
     * myArray.filter(myFunction, me);
     * 
*

the function myFunction is a member function of the Timeline class, which cannot be overridden * by me. Flash Player will throw an exception. * You can avoid this runtime error by assigning the function to a variable, as follows:

*
     * var foo:Function = myFunction() {
     *     //your code here
     *     };
     * myArray.filter(foo, me);
     * 
* @playerversion Flash 9 * @langversion 3.0 * @param callback The function to run on each item in the array. This function can contain a simple comparison (for example, item < 20) or a more complex operation, and it can be invoked with three arguments: the value of * an item, the index of an item, and the Array object as in (item, index, array). * * @param thisObject An object to use as this for the function. * @return A Boolean value; true if all items in the array return true for the specified function, otherwise false. * * @includeExample examples\Array.every.as -noswf * @see #some() Array.some() */ public native function every(callback:Function, thisObject=null):Boolean; /** * Executes a test function on each item in the array and constructs a new array for all items that return true for the specified function. If an item returns false, it is not included in the new array. *

For this method, the second parameter, thisObject, must be null if the * first parameter, callback, is a method closure. In other words, if you create a function in a movie clip * called me:

*
     * function myFunction(){
     *    //your code here
     * }
     * 
*

and then use the filter method on an array called myArray:

*
     * myArray.filter(myFunction, me);
     * 
*

the function myFunction is a member function of the Timeline class, which cannot be overridden * by me. Flash Player will throw an exception. * You can avoid this runtime error by assigning the function to a variable, as follows:

*
     * var foo:Function = myFunction() {
     *     //your code here
     *     };
     * myArray.filter(foo, me);
     * 
* * @playerversion Flash 9 * @langversion 3.0 * @param callback The function to run on each item in the array. This function can contain a simple comparison (for example, item < 20) or a more complex operation and will be invoked with three arguments, including the * value of an item, the index of an item, and the Array object as in: *
    function callback(item:*, index:int, array:Array):void;
* * @param thisObject An object to use as this for the function. * @return A new array containing all items from the original array that returned true. * * @includeExample examples\Array.filter.as -noswf * @see #map() Array.map() */ public native function filter(callback:Function, thisObject=null):Array; /** * Executes a function on each item in the array. *

For this method, the second parameter, thisObject, must be null if the * first parameter, callback, is a method closure. In other words, if you create a function in a movie clip * called me:

*
     * function myFunction(){
     *    //your code here
     * }
     * 
*

and then use the filter method on an array called myArray:

*
     * myArray.filter(myFunction, me);
     * 
*

the function myFunction is a member function of the Timeline class, which cannot be overridden * by me. Flash Player will throw an exception. * You can avoid this runtime error by assigning the function to a variable, as follows:

*
     * var foo:Function = myFunction() {
     *     //your code here
     *     };
     * myArray.filter(foo, me);
     * 
* @playerversion Flash 9 * @langversion 3.0 * @param callback The function to run on each item in the array. This function can contain a simple command * (for example, a trace() statement) or a more complex operation and it can be invoked with three arguments, * including the value of an item, the index of an item, and the Array object as in: *
    function callback(item:*, index:int, array:Array):void;
* * @param thisObject An object to use as this for the function. * * @includeExample examples\Array.forEach.as -noswf * @includeExample examples\Array.forEach.2.as -noswf */ public native function forEach(callback:Function, thisObject=null):void; /** * Searches for an item in an array using strict equality (===) and returns the index * position of the item. * @playerversion Flash 9 * @langversion 3.0 * @param searchElement The item to find in the array. * * @param fromIndex The location in the array from which to start searching for the item. * @return A zero-based index position of the item in the array. If the searchElement argument * is not found the return value will be -1. * * @includeExample examples\Array.indexOf.as -noswf * @see #lastIndexOf() Array.lastIndexOf() * @see operators.html#strict_equality === (strict equality) */ public native function indexOf(searchElement, fromIndex:int=0):int; /** * Converts the elements in an array to strings, inserts the specified separator between the * elements, concatenates them, and returns the resulting string. A nested array is always * separated by a comma (,), not by the separator passed to the join() method. * * @tiptext Converts the elements in an array to strings. * * @playerversion Flash 9 * @langversion 3.0 * * @param sep A character or string that separates array elements in * the returned string. If you omit this parameter, a comma is used as the default * separator. * * @return A string consisting of the elements of an array * converted to strings and separated by the specified parameter. * * @includeExample examples\Array.join.1.as -noswf * @includeExample examples\Array.join.2.as -noswf * * @oldsee mx.String#split mx.String.split() * @see String#split() * * @helpid x2089E * @refpath Objects/Core/Array/Methods/join * @keyword array.join, join */ public native function join(sep=void 0):String; /** * Searches for an item in an array, working backward from the last item, and returns the index position of the matching item using strict equality (===). * @playerversion Flash 9 * @langversion 3.0 * @param searchElement The item to find in the array. * * @param fromIndex The location in the array from which to start searching for the item. The default is the maximum * value allowed for an index. If fromIndex is not specified, the search starts at the last item * in the array. * @return A zero-based index position of the item in the array. If the searchElement argument is * not found the return value will be -1. * * @includeExample examples\Array.lastIndexOf.as -noswf * @see #indexOf() Array.indexOf() * @see operators.html#strict_equality === (strict equality) */ public native function lastIndexOf(searchElement, fromIndex:int=0x7fffffff):int; /** * Executes a function on each item in an array, and constructs a new array of items corresponding to the results of the function on each item in the original array. *

For this method, the second parameter, thisObject, must be null if the * first parameter, callback, is a method closure. In other words, if you create a function in a movie clip * called me:

*
     * function myFunction(){
     *    //your code here
     * }
     * 
*

and then use the filter method on an array called myArray:

*
     * myArray.filter(myFunction, me);
     * 
*

the function myFunction is a member function of the Timeline class, which cannot be overridden * by me. Flash Player will throw an exception. * You can avoid this runtime error by assigning the function to a variable, as follows:

*
     * var foo:Function = myFunction() {
     *     //your code here
     *     };
     * myArray.filter(foo, me);
     * 
* @playerversion Flash 9 * @langversion 3.0 * @param callback The function to run on each item in the array. This function can contain a simple command (such as changing the case of an array of strings) or a more complex operation and will be invoked with three arguments, * including the value of an item, the index of an item, and the Array object as in: *
    function callback(item:*, index:int, array:Array):void;
* * @param thisObject An object to use as this for the function. * @return A new array containing the results of the function on each item in the original array. * * @includeExample examples\Array.map.as -noswf * @see #filter() Array.filter() */ public native function map(callback:Function, thisObject=null):Array /** * Removes the last element from an array and returns the value of that element. * * @playerversion Flash 9 * @langversion 3.0 * * @return The value of the last element (of any data type) in the specified array. * * @includeExample examples\Array.pop.1.as -noswf * * @see #push() Array.push() * @see #shift() Array.shift() * @see #unshift() Array.unshift() * * @helpid x208A2 * @refpath Objects/Core/Array/Methods/pop * @keyword array.pop, pop */ public native function pop():Object; /** * Adds one or more elements to the end of an array and returns the new length of the array. * * * @playerversion Flash 9 * @langversion 3.0 * * @param ...args One or more values to append to the array. * @return An integer representing the length of the new array. * * @includeExample examples\Array.push.1.as -noswf * @includeExample examples\Array.push.2.as -noswf * * @see #pop() Array.pop() * @see #shift() Array.shift() * @see #unshift() Array.unshift() * * @helpid x208A3 * @refpath Objects/Core/Array/Methods/push * @keyword array.push, push */ public native function push( ...args):uint; /** * Reverses the array in place. * * @playerversion Flash 9 * @langversion 3.0 * * @includeExample examples\Array.reverse.1.as -noswf * * @return The new array. * @helpid x2099E * @refpath Objects/Core/Array/Methods/reverse * @keyword array.reverse, reverse */ public native function reverse():Array; /** * Removes the first element from an array and returns that element. The remaining elements in the array are moved * from their original position, i, to i-1. * * @playerversion Flash 9 * @langversion 3.0 * * @return The first element (of any data type) in an array. * * @includeExample examples\Array.shift.1.as -noswf * * @see #pop() Array.pop() * @see #push() Array.push() * @see #unshift() Array.unshift() * * @helpid x208A4 * @refpath Objects/Core/Array/Methods/shift * @keyword array.shift, shift */ public native function shift():Object; /** * Returns a new array that consists of a range of elements from the original array, without modifying the original array. The returned array includes the startIndex element and all elements up to, but not including, the endIndex element. *

If you don't pass any parameters, a duplicate of the original array is created.

* * @tiptext Returns a new array that consists of a range of elements from the original array. * * @playerversion Flash 9 * @langversion 3.0 * * @param startIndex A number specifying the index of the starting point * for the slice. If start is a negative number, the starting * point begins at the end of the array, where -1 is the last element. * * @param endIndex A number specifying the index of the ending point for * the slice. If you omit this parameter, the slice includes all elements from the * starting point to the end of the array. If end is a negative * number, the ending point is specified from the end of the array, where -1 is the * last element. * * @return An array that consists of a range of elements from the original array. * * @includeExample examples\Array.slice.1.as -noswf * @includeExample examples\Array.slice.2.as -noswf * @includeExample examples\Array.slice.3.as -noswf * * @helpid x208A5 * @refpath Objects/Core/Array/Methods/slice * @keyword array.slice, slice */ public native function slice(startIndex:int=0, endIndex:int=-1):Array; /** * Executes a test function on each item in the array until an item is reached that returns true for the specified function. Use this method to find out if any items in an array meet a certain criterion, such as having a value less than some number. *

For this method, the second parameter, thisObject, must be null if the * first parameter, callback, is a method closure. In other words, if you create a function in a movie clip * called me:

*
     * function myFunction(){
     *    //your code here
     * }
     * 
*

and then use the filter method on an array called myArray:

*
     * myArray.filter(myFunction, me);
     * 
*

the function myFunction is a member function of the Timeline class, which cannot be overridden * by me. Flash Player will throw an exception. * You can avoid this runtime error by assigning the function to a variable, as follows:

*
     * var foo:Function = myFunction() {
     *     //your code here
     *     };
     * myArray.filter(foo, me);
     * 
* @playerversion Flash 9 * @langversion 3.0 * @param callback The function to run on each item in the array. This function can contain a simple comparison (for example * item < 20) or a more complex operation and it is invoked with three arguments, including the * value of an item, the index of an item, and the Array object as in: *
    function callback(item:*, index:int, array:Array):void;
* * @param thisObject An object to use as this for the function. * @return A Boolean value; true if any items in the array return true for the specified function, otherwise false. * * @includeExample examples\Array.some.as -noswf * @see #every() Array.every() */ public native function some(callback:Function, thisObject=null):Boolean; /** * Sorts the elements in an array. Flash sorts according to Unicode values. (ASCII is a subset of Unicode.) *

By default, Array.sort() works in the following way:

* *

* To sort an array by using settings that deviate from the default settings, * you can either use one of the sorting options described in the ...args parameter entry * for the sortOptions argument or you can create your own custom function to do the sorting. * If you create a custom function, you can use it by calling the sort() method, using the name * of your custom function as the first argument (compareFunction) *

* * @playerversion Flash 9 * @langversion 3.0 * * @param ...args The arguments specifying a comparison function and one or more values that determine the behavior of the sort. *

This method uses the syntax and argument order Array.sort(compareFunction, sortOptions) with the arguments defined as:

* *

Note: The Array.sort() method is defined in the ECMAScript (ECMA-262) edition 3 * language specification, but the * array sorting options introduced in Flash Player 7 are Flash-specific extensions to * ECMA-262. *

* @return The return value depends on whether you pass any arguments, as described in * the following list: * * * @includeExample examples\Array.sort.1.as -noswf * @includeExample examples\Array.sort.2.as -noswf * @includeExample examples\Array.sort.3.as -noswf * @includeExample examples\Array.sort.4.as -noswf * @includeExample examples\Array.sort.5.as -noswf * * @see operators.html#bitwise_OR | (bitwise OR) * @see #sortOn() Array.sortOn() * * @helpid x209AF * @refpath * @keyword array.sort, sort */ public native function sort(...args):Array; /** * Sorts the elements in an array according to one or more fields in the array. * The array should have the following characteristics: * *

If you pass multiple fieldName parameters, the first field represents the primary sort field, the second represents the next sort field, and so on. Flash sorts according to Unicode values. (ASCII is a subset of Unicode.) If either of the elements being compared does not contain the field that is specified in the fieldName parameter, the field is assumed to be set to undefined, and the elements are placed consecutively in the sorted array in no particular order.

*

By default, Array.sortOn() works in the following way:

* *

Flash Player 7 added the options parameter, which you can use to override the default sort behavior. To sort a simple array (for example, an array with only one field), or to specify a sort order that the options parameter doesn't support, use Array.sort().

*

To pass multiple flags, separate them with the bitwise OR (|) operator:

* * my_array.sortOn(someFieldName, Array.DESCENDING | Array.NUMERIC); * *

Flash Player 8 added the ability to specify a different sorting option for each field when you sort by more than one field. In Flash Player 8, the options parameter accepts an array of sort options such that each sort option corresponds to a sort field in the fieldName parameter. The following example sorts the primary sort field, a, using a descending sort; the secondary sort field, b, using a numeric sort; and the tertiary sort field, c, using a case-insensitive sort:

* * Array.sortOn (["a", "b", "c"], [Array.DESCENDING, Array.NUMERIC, Array.CASEINSENSITIVE]); * *

Note: The fieldName and options arrays must have the same number of elements; otherwise, the options array is ignored. Also, the Array.UNIQUESORT and Array.RETURNINDEXEDARRAY options can be used only as the first element in the array; otherwise, they are ignored.

* * @playerversion Flash 9 * @langversion 3.0 * * @param fieldName A string that identifies a field to be used as the sort value, or an * array in which the first element represents the primary sort field, the second represents * the secondary sort field, and so on. * * @param options One or more numbers or names of defined constants, separated by the bitwise OR (|) operator, that change the sorting behavior. The following values are acceptable for the options parameter: * *

Code hinting is enabled if you use the string form of the flag (for example, DESCENDING) rather than the numeric form (2).

* * * @return The return value depends on whether you pass any parameters: * * * @includeExample examples\Array.sortOn.1.as -noswf * @includeExample examples\Array.sortOn.2.as -noswf * @includeExample examples\Array.sortOn.3.as -noswf * * @see operators.html#bitwise_OR | (bitwise OR) * @see #sort() Array.sort() * * @helpid x2058F * @refpath Objects/Core/Array/Methods/sortOn * @keyword array.sortOn, sortOn */ public native function sortOn(fieldName:Object, options:Object = null):Array; // 'key' is a String, or an Array of String. 'options' is optional. /** * Adds elements to and removes elements from an array. This method modifies the array without * making a copy. *

Note: To override this method in a subclass of Array, use ...args for the parameters. * For example:

*
	 * public override function splice(...args) {
	 *   // your statements here
	 * }
	 * 
* @playerversion Flash 9 * @langversion 3.0 * * @param startIndex An integer that specifies the index of the element in the array where the insertion or * deletion begins. You can specify a negative integer to specify a position relative to the end of the array * (for example, -1 is the last element of the array). * @param deleteCount An integer that specifies the number of elements to be deleted. This number includes the * element specified in the startIndex parameter. If no value is specified for the * deleteCount parameter, the method deletes all of the values from the startIndex * element to the last element in the array. If the value is 0, no elements are deleted. * @param values An optional list of one or more comma-separated values, or an array, * to insert into the array at the insertion point specified in the startIndex parameter. * * @return An array containing the elements that were removed from the original array. * * @includeExample examples\Array.splice.1.as -noswf * * @helpid x208A6 * @refpath Objects/Core/Array/Methods/splice * @keyword array.splice, splice */ public native function splice(startIndex:int, deleteCount:uint, ... values):Array; /** * Returns a string value representing the elements in the specified Array object. Every element in the array, starting with index 0 and ending with the highest index, is converted to a concatenated string and separated by commas. To specify a custom separator, use the Array.join() method. * * * @playerversion Flash 9 * @langversion 3.0 * * @return A string. * * @includeExample examples\Array.toString.1.as -noswf * *

This example outputs 1,2,3,4,5 as a result of the trace statement.

*

This example writes 1,2,3,4,5 to the log file.

* * @see String#split() String.split() * @see #join() Array.join() * * @helpid x20A11 * @refpath Objects/Core/Array/Methods/toString * @keyword array.toString, toString */ public native function toString():String; /** * Returns a string value representing the elements in the specified array object. Every element in the array, starting with index 0 and ending with the highest index, is converted to a concatenated string and separated by commas. In the ActionScript 3.0 implementation, this method returns the same value as the Array.toString() method. * * * @playerversion Flash 9 * @langversion 3.0 * * @return A string. * @see #toString() Array.toString() */ public native function toLocaleString():String; /** * Adds one or more elements to the beginning of an array and returns the new length of the array. The other * elements in the array are moved from their original position, i, to i+1. * * @playerversion Flash 9 * @langversion 3.0 * * @param ...args One or more numbers, elements, or variables to be inserted at the beginning of the array. * * @return An integer representing the new length of the array. * * @includeExample examples\Array.unshift.1.as -noswf * * @see Array#pop() * @see Array#push() * @see Array#shift() * @helpid x208A7 * @refpath Objects/Core/Array/Methods/unshift * @keyword array.unshift, unshift */ public native function unshift( ...args):uint; /** * The default number of arguments for the constructor. You can specify 0, 1, or any number of arguments. For details, see the Array() constructor function. * @playerversion Flash 9 * @langversion 3.0 * @see #Array() */ public static const length:int = 1; } } package { //**************************************************************************** // ActionScript Standard Library // Boolean object //**************************************************************************** /** * A data type that can have one of two values, either true or false. * Used for logical operations. Use the Boolean * class to retrieve the primitive data type or string representation of a Boolean object. * *

It makes no difference whether you use the constructor, the global function, or simply assign * a literal value. The fact that all three ways of creating a Boolean are equivalent is new in ActionScript 3.0, * and different from a Boolean in JavaScript where a Boolean object is distinct from the Boolean primitive type.

* *

The following lines of code are equivalent:

* * var flag:Boolean = true; * var flag:Boolean = new Boolean(true); * var flag:Boolean = Boolean(true); * * * @includeExample examples\BooleanExample.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid x208C1 * @keyword boolean, built-in class * @refpath Objects/Core/Boolean/ */ public final class Boolean { /** * Creates a Boolean object with the specified value. If you omit the expression * parameter, the Boolean object is initialized with a value of false. If you * specify a value for the expression parameter, the method evaluates it and returns the result * as a Boolean value according to the rules in the global Boolean() function. * * @playerversion Flash 9 * @langversion 3.0 * * @param expression Any expression. * * @return A reference to a Boolean object. * * @example The following code creates a new Boolean object, initialized to a value of false called myBoolean: * * var myBoolean:Boolean = new Boolean(); * * * @see package.html#Boolean() Boolean() * @helpid x208C0 * @refpath Objects/Core/Boolean/new Boolean * @keyword new boolean, constructor */ public native function Boolean(expression:Object = false); /** * The default number of arguments for the constructor. For details, see the Boolean() constructor function. * @playerversion Flash 9 * @langversion 3.0 * @see #Boolean() */ public static const length:int = 1; /** * Returns the string representation ("true" or * "false") of the Boolean object. The output is not localized, and will be "true" or * "false" regardless of the system language. * * @playerversion Flash 9 * @langversion 3.0 * * @return A string; "true" or "false". * * @example This example creates a variable of type Boolean and then uses the toString() method * to convert the value to a string for use in an array of strings: * * var myStringArray:Array = new Array("yes", "could be"); * var myBool:Boolean = 0; * myBool.toString(); * myStringArray.push(myBool); * * * * @helpid x208C2 * @refpath Objects/Core/Boolean/Methods/toString * @keyword boolean.toString, toString */ public native function toString():String; /** * Returns true if the value of the specified Boolean * object is true; false otherwise. * * @playerversion Flash 9 * @langversion 3.0 * * @return A Boolean value. * * @example The following example shows how this method works, and also shows that the * value of a new Boolean object is false: * * var myBool:Boolean = new Boolean(); * trace(myBool.valueOf());   // false * myBool = (6==3+3); * trace(myBool.valueOf());   // true * * * * @helpid x208C3 * @refpath Objects/Core/Boolean/Methods/valueOf * @keyword boolean.valueOf, valueOf */ public native function valueOf():Boolean; } } package { //**************************************************************************** // ActionScript Standard Library // Class object //**************************************************************************** /** * A class object is created for each class definition in a program. Every class object is an instance * of the Class class. The class object contains the static properties and methods of the class. The * class object creates instances of the class when invoked using the new operator. * *

Some methods return an object of type Class, such as flash.net.getClassByAlias(). * Other methods may have a parameter of type Class, such as flash.net.registerClassAlias().

*

The Class name is the reference to the class object.

*

For example:

*
 
 * class Foo {
 * }
 * 
*

class Foo{} is the class definition that creates a class object Foo. Additionally, the statement * new Foo() will create a new instance of class Foo, and the result will be of type Foo.

*

Use the class statement to declare your classes. Class objects are useful for advanced * techniques, such as the runtime assignment of classes to an existing instance object, as shown in the "Class Examples" * section below.

*

Any static properties and methods of a class live on the class's Class object. Class, itself, declares * prototype.

* *

Generally, you do not need to declare or create variables of type Class manually. However, in the following * code, a class is assigned as a public Class property circleClass, and you can refer to this Class property * as a property of the main Library class:

* * package { * import flash.display.Sprite; * public class Library extends Sprite { * * public var circleClass:Class = Circle; * public function Library() { * } * } * } * * import flash.display.Shape; * class Circle extends Shape { * public function Circle(color:uint = 0xFFCC00, radius:Number = 10) { * graphics.beginFill(color); * graphics.drawCircle(radius, radius, radius); * } * } * * *

Another SWF file can load the resulting Library.swf file and then instantiate objects of type Circle. The * following is one way, not the only way, to get access to a child SWF file's assets (other techniques include using * flash.utils.getDefnitionByName() or importing stub definitions of the child SWF file):

* * * package { * import flash.display.Sprite; * import flash.display.Shape; * import flash.display.Loader; * import flash.net.URLRequest; * import flash.events.Event; * public class LibaryLoader extends Sprite { * public function LibaryLoader() { * var ldr:Loader = new Loader(); * var urlReq:URLRequest = new URLRequest("Library.swf"); * ldr.load(urlReq); * ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, loaded); * } * private function loaded(event:Event):void { * var library:Object = event.target.content; * var circle:Shape = new library.circleClass(); * addChild(circle); * } * } * } * *

In ActionScript 3.0, you can create embedded classes for external assets (such as images, sounds, or fonts) that are * compiled into SWF files. In earlier versions of ActionScript, you associated those assets using a linkage ID with the * MovieClip.attachMovie() method. In ActionScript 3.0, each embedded asset is represented by a unique embedded * asset class. So, you can use the new operator to instantiate the asset's associated class and call methods and properties * on that asset.

*

For example, if you are using an MXML compiler to generate SWF files, you would create an embedded * class as follows:

*
 *     [Embed(source="bratwurst.jpg")]
 *     public var imgClass:Class;
 * 
*

And, to instantiate it, you write the following:

*
 *     var myImg:Bitmap = new imgClass();
 * 
*
* * @includeExample examples\Class.1.as -noswf * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword Class * @see Object#prototype * @see operators.html#new new operator */ public dynamic class Class { } } package { // Top Level Constants /** * A special value representing positive Infinity. The value of this constant is the same as Number.POSITIVE_Infinity. * @includeExample examples\Constants.Infinity.1.as -noswf * @see Number#POSITIVE_Infinity */ public const Infinity:Number; /** * A special value representing negative Infinity. The value of this constant is the same as Number.NEGATIVE_Infinity. * @includeExample examples\Constants.NegInfinity.1.as -noswf * @see Number#NEGATIVE_Infinity */ public const Infinity:Number; /** * A special member of the Number data type that represents a value that is "not a number" (NaN). * When a mathematical expression results in a value that cannot be expressed as a number, the result is NaN. * The following list describes common expressions that result in NaN. * *

The NaN value is not a member of the int or uint data types.

*

The NaN value is not considered equal to any other value, including NaN, which makes it impossible to use the equality operator to test whether an expression is NaN. To determine whether a number is the NaN function, use isNaN().

* * @see global#isNaN() * @see Number#NaN */ public const NaN:Number; /** * A special value that applies to untyped variables that have not been initialized or dynamic object properties that are not initialized. * In ActionScript 3.0, only variables that are untyped can hold the value undefined, * which is not true in ActionScript 1.0 and ActionScript 2.0. * For example, both of the following variables are undefined because they are untyped and unitialized: * *

The undefined value also applies to uninitialized or undefined properties of dynamic objects. * For example, if an object is an instance of the Object class, * the value of any dynamically added property is undefined until a value is assigned to that property. *

*

Results vary when undefined is used with various functions:

* *

Do not confuse undefined with null. * When null and undefined are compared with the equality * (==) operator, they compare as equal. However, when null and undefined are * compared with the strict equality (===) operator, they compare * as not equal.

* @includeExample examples\Constants.undefined.1.as -noswf * @includeExample examples\Constants.undefined.2.as -noswf * @see global#null */ public const undefined; } package { //**************************************************************************** // ActionScript Standard Library // Date object //**************************************************************************** /** * The Date class represents date and time information. An instance of the Date class represents a particular point in time for which the properties such as month, day, hours and seconds can be queried or modified. The Date class lets you retrieve date and time values relative to universal time (Greenwich mean time, now called universal time or UTC) or relative to local time, which is determined by the local time zone setting on the operating system running Flash Player. The methods of the Date class are not static but apply only to the individual Date object specified when the method is called. The Date.UTC() and Date.parse() methods are exceptions; they are static methods. *

The Date class handles daylight saving time differently, depending on the operating system and Flash Player version. Flash Player 6 and later versions handle daylight saving time on the following operating systems in these ways:

* *

Flash Player 5 handles daylight saving time on the following operating systems as follows:

*
*

To use the Date class, construct a Date instance using the new operator.

*

ActionScript 3.0 adds several new accessor properties that can be used in place of many Date class methods that access or modify Date instances. ActionScript 3.0 also includes several new variations of the toString() method that are included for ECMA-262 3rd Edition compliance, including: Date.toLocaleString(), Date.toTimeString(), Date.toLocaleTimeString(), Date.toDateString(), Date.toLocaleDateString().

*

To compute relative time or time elapsed, see the getTimer() method in the flash.utils package.

* * @playerversion Flash 9 * @langversion 3.0 * * @includeExample examples\DateExample.as -noswf * @see flash.utils#getTimer() flash.utils.getTimer() * * @helpid x208E9 * @refpath Objects/Core/Date * @keyword Date object, built-in class, date */ public final dynamic class Date { /** * The default number of arguments for the constructor. You can specify 0, 1, or any number of arguments * up to a maximum of 7. For details, see the Date() constructor function. * @playerversion Flash 9 * @langversion 3.0 * @see #Date() */ public static const length:int = 7; /** * The full year (a four-digit number, such as 2000) of a Date object * according to local time. Local time is determined by the operating system on which * Flash Player is running. * * @playerversion Flash 9 * @langversion 3.0 * * @see #getFullYear() * @see #setFullYear() */ public function get fullYear():Number { return getFullYear(); } public function set fullYear(value:Number):void { setFullYear(value); } /** * The month (0 for January, 1 for February, and so on) portion of a * Date object according to local time. Local time is determined by the operating system * on which Flash Player is running. * * @playerversion Flash 9 * @langversion 3.0 * * @see #getMonth() * @see #setMonth() */ public function get month():Number { return getMonth(); } public function set month(value:Number):void { setMonth(value); } /** * The day of the month (an integer from 1 to 31) specified by a Date object * according to local time. Local time is determined by the operating system on which * Flash Player is running. * * @playerversion Flash 9 * @langversion 3.0 * * @see #getDate() * @see #setDate() */ public function get date():Number { return getDate(); } public function set date(value:Number):void { setDate(value); } /** * The hour (an integer from 0 to 23) of the day portion of a Date object * according to local time. Local time is determined by the operating system on which * Flash Player is running. * * @playerversion Flash 9 * @langversion 3.0 * * @see #getHours() * @see #setHours() */ public function get hours():Number { return getHours(); } public function set hours(value:Number):void { setHours(value); } /** * The minutes (an integer from 0 to 59) portion of a Date object * according to local time. Local time is determined by the operating system on which * Flash Player is running. * * @playerversion Flash 9 * @langversion 3.0 * * @see #getMinutes() * @see #setMinutes() */ public function get minutes():Number { return getMinutes(); } public function set minutes(value:Number):void { setMinutes(value); } /** * The seconds (an integer from 0 to 59) portion of a Date object * according to local time. Local time is determined by the operating system on which * Flash Player is running. * * @playerversion Flash 9 * @langversion 3.0 * * @see #getSeconds() * @see #setSeconds() */ public function get seconds():Number { return getSeconds(); } public function set seconds(value:Number):void { setSeconds(value); } /** * The milliseconds (an integer from 0 to 999) portion of a Date object * according to local time. Local time is determined by the operating system on which * Flash Player is running. * * @playerversion Flash 9 * @langversion 3.0 * * @see #getMilliseconds() * @see #setMilliseconds() */ public function get milliseconds():Number { return getMilliseconds(); } public function set milliseconds(value:Number):void { setMilliseconds(value); } /** * The four-digit year of a Date object according to universal time (UTC). * * @playerversion Flash 9 * @langversion 3.0 * * @see #getUTCFullYear() * @see #setUTCFullYear() */ public function get fullYearUTC():Number { return getUTCFullYear(); } public function set fullYearUTC(value:Number):void { setUTCFullYear(value); } /** * The month (0 [January] to 11 [December]) portion of a Date object * according to universal time (UTC). * * @playerversion Flash 9 * @langversion 3.0 * * @see #getUTCMonth() * @see #setUTCMonth() */ public function get monthUTC():Number { return getUTCMonth(); } public function set monthUTC(value:Number):void { setUTCMonth(value); } /** * The day of the month (an integer from 1 to 31) of a Date object * according to universal time (UTC). * * @playerversion Flash 9 * @langversion 3.0 * * @see #getUTCDate() * @see #setUTCDate() */ public function get dateUTC():Number { return getUTCDate(); } public function set dateUTC(value:Number):void { setUTCDate(value); } /** * The hour (an integer from 0 to 23) of the day of a Date object * according to universal time (UTC). * * @playerversion Flash 9 * @langversion 3.0 * * @see #getUTCHours() * @see #setUTCHours() */ public function get hoursUTC():Number { return getUTCHours(); } public function set hoursUTC(value:Number):void { setUTCHours(value); } /** * The minutes (an integer from 0 to 59) portion of a Date object * according to universal time (UTC). * * @playerversion Flash 9 * @langversion 3.0 * * @see #getUTCMinutes() * @see #setUTCMinutes() */ public function get minutesUTC():Number { return getUTCMinutes(); } public function set minutesUTC(value:Number):void { setUTCMinutes(value); } /** * The seconds (an integer from 0 to 59) portion of a Date object * according to universal time (UTC). * * @playerversion Flash 9 * @langversion 3.0 * * @see #getUTCSeconds() * @see #setUTCSeconds() */ public function get secondsUTC():Number { return getUTCSeconds(); } public function set secondsUTC(value:Number):void { setUTCSeconds(value); } /** * The milliseconds (an integer from 0 to 999) portion of a Date object * according to universal time (UTC). * * @playerversion Flash 9 * @langversion 3.0 * * @see #getUTCMilliseconds() * @see #setUTCMilliseconds() */ public function get millisecondsUTC():Number { return getUTCMilliseconds(); } public function set millisecondsUTC(value:Number):void { setUTCMilliseconds(value); } /** * The number of milliseconds since midnight January 1, 1970, universal time, * for a Date object. Use this method to represent a specific instant in time * when comparing two or more Date objects. * * @playerversion Flash 9 * @langversion 3.0 * * @see #getTime() * @see #setTime() */ public function get time():Number { return getTime(); } public function set time(value:Number):void { setTime(value); } /** * The difference, in minutes, between the computer's local time and universal * time (UTC). * * @playerversion Flash 9 * @langversion 3.0 * * @see #getTimezoneOffset() */ public function get timezoneOffset():Number { return getTimezoneOffset(); } /** * The day of the week (0 for Sunday, 1 for Monday, and so on) specified by this * Date according to local time. Local time is determined by the operating * system on which Flash Player is running. * * @playerversion Flash 9 * @langversion 3.0 * * @see #getDay() */ public function get day():Number { return getDay(); } /** * The day of the week (0 for Sunday, 1 for Monday, and so on) of this Date * according to universal time (UTC). * * @playerversion Flash 9 * @langversion 3.0 * * @see #getUTCDay() */ public function get dayUTC():Number { return getUTCDay(); } /** * Returns the number of milliseconds between midnight on January 1, 1970, universal time, * and the time specified in the parameters. This method uses universal time, whereas the * Date constructor uses local time. *

This method is useful if you want to pass a UTC date to the Date class constructor. * Because the Date class constructor accepts the millisecond offset as an argument, you * can use the Date.UTC() method to convert your UTC date into the corresponding millisecond * offset, and send that offset as an argument to the Date class constructor:

* * @playerversion Flash 9 * @langversion 3.0 * * @param year A four-digit integer that represents the year (for example, 2000). * * @param month An integer from 0 (January) to 11 (December). * * @param date An integer from 1 to 31. * * @param hour An integer from 0 (midnight) to 23 (11 p.m.). * * @param minute An integer from 0 to 59. * * @param second An integer from 0 to 59. * * @param millisecond An integer from 0 to 999. * * @return The number of milliseconds since January 1, 1970 and the specified date and time. * * @includeExample examples\Date.UTC.1.as -noswf * * @helpid x2090F * @refpath Objects/Core/Date/Methods/UTC * @keyword date.utc, utc, date */ public native static function UTC(year:Number,month:Number,date:Number = 1, hour:Number = 0,minute:Number = 0,second:Number = 0,millisecond:Number = 0):Number; /** * Constructs a new Date object that holds the specified date and time. * *

The Date() constructor takes up to seven parameters (year, month, * ..., millisecond) to specify a date and time to the millisecond. The date that * the newly constructed Date object contains depends on the number, and data type, of arguments passed.

* *

If you pass a string to the Date class constructor, the date can be in a variety of formats, but must at least include the month, date and year. For example, Feb 1 2005 is valid, but Feb 2005 is not. The following list indicates some of the valid formats:

* * @param yearOrTimevalue If other parameters are specified, this number represents a * year (such as 1965); otherwise, it represents a time value. If the number represents a year, a * value of 0 to 99 indicates 1900 through 1999; otherwise all four digits of the year must be * specified. If the number represents a time value (no other parameters are specified), it is the * number of milliseconds before or after 0:00:00 GMT January 1, 1970; a negative values represents * a time before 0:00:00 GMT January 1, 1970, and a positive value represents a time after. * * @param month An integer from 0 (January) to 11 (December). * * @param date An integer from 1 to 31. * * @param hour An integer from 0 (midnight) to 23 (11 p.m.). * * @param minute An integer from 0 to 59. * * @param second An integer from 0 to 59. * * @param millisecond An integer from 0 to 999 of milliseconds. * * @playerversion Flash 9 * @langversion 3.0 * * @see #getMonth() * @see #getDate() * @see #getFullYear() * @helpid x208FD * @refpath Objects/Core/Date/new Date * @keyword new Date, constructor, date */ public native function Date(yearOrTimevalue:Object,month:Number,date:Number = 1,hour:Number = 0,minute:Number = 0,second:Number = 0,millisecond:Number = 0); /** * Returns the day of the month (an integer from 1 to 31) specified by a Date object * according to local time. Local time is determined by the operating system on which * Flash Player is running. * * @playerversion Flash 9 * @langversion 3.0 * * @return The day of the month (1 - 31) a Date object represents. * * @includeExample examples\Date.getDate.1.as -noswf * * @see #getMonth() * @see #getFullYear() * @helpid x208EA * @refpath Objects/Core/Date/Methods/getDate * @keyword date.getdate, getdate, date */ public native function getDate():Number; /** * Returns the day of the week (0 for Sunday, 1 for Monday, and so on) specified by this * Date according to local time. Local time is determined by the operating * system on which Flash Player is running. * * @playerversion Flash 9 * @langversion 3.0 * * @return A numeric version of the day of the week (0 - 6) a Date object * represents. * * @includeExample examples\Date.getDay.1.as -noswf * * @helpid x208EB * @refpath Objects/Core/Date/Methods/getDay * @keyword date.getday, getday, date */ public native function getDay():Number; /** * Returns the full year (a four-digit number, such as 2000) of a Date object * according to local time. Local time is determined by the operating system on which * Flash Player is running. * * @playerversion Flash 9 * @langversion 3.0 * * @return The full year a Date object represents. * * @includeExample examples\Date.getFullYear.1.as -noswf * * @helpid x208EC * @refpath Objects/Core/Date/Methods/getFullYear * @keyword date.getfullyear, getfullyear, date */ public native function getFullYear():Number; /** * Returns the hour (an integer from 0 to 23) of the day portion of a Date object * according to local time. Local time is determined by the operating system on which * Flash Player is running. * * @playerversion Flash 9 * @langversion 3.0 * * @return The hour (0 - 23) of the day a Date object represents. * * @includeExample examples\Date.getHours.1.as -noswf * * @helpid x208ED * @refpath Objects/Core/Date/Methods/getHours * @keyword date.gethours, gethours, date */ public native function getHours():Number; /** * Returns the milliseconds (an integer from 0 to 999) portion of a Date object * according to local time. Local time is determined by the operating system on which * Flash Player is running. * * @playerversion Flash 9 * @langversion 3.0 * * @return The milliseconds portion of a Date object. * * @includeExample examples\Date.getMilliseconds.1.as -noswf * * @helpid x208EE * @refpath Objects/Core/Date/Methods/getMilliseconds * @keyword date.getmilliseconds, getmilliseconds, date */ public native function getMilliseconds():Number; /** * Returns the minutes (an integer from 0 to 59) portion of a Date object * according to local time. Local time is determined by the operating system on which * Flash Player is running. * * @playerversion Flash 9 * @langversion 3.0 * * @return The minutes portion of a Date object. * * @includeExample examples\Date.getMinutes.1.as -noswf * * @helpid x208EF * @refpath Objects/Core/Date/Methods/getMinutes * @keyword date.getminutes, getminutes, date */ public native function getMinutes():Number; /** * Returns the month (0 for January, 1 for February, and so on) portion of this * Date according to local time. Local time is determined by the operating system * on which Flash Player is running. * * @playerversion Flash 9 * @langversion 3.0 * * @return The month (0 - 11) portion of a Date object. * * @includeExample examples\Date.getMonth.1.as -noswf * * @helpid x208F0 * @refpath Objects/Core/Date/Methods/getMonth * @keyword date.getmonth, getmonth, date */ public native function getMonth():Number; /** * Returns the seconds (an integer from 0 to 59) portion of a Date object * according to local time. Local time is determined by the operating system on which * Flash Player is running. * * @playerversion Flash 9 * @langversion 3.0 * * @return The seconds (0 to 59) portion of a Date object. * * @includeExample examples\Date.getSeconds.1.as -noswf * * @helpid x208F1 * @refpath Objects/Core/Date/Methods/getSeconds * @keyword date.getseconds, getseconds, date */ public native function getSeconds():Number; /** * Returns the number of milliseconds since midnight January 1, 1970, universal time, * for a Date object. Use this method to represent a specific instant in time * when comparing two or more Date objects. * * @playerversion Flash 9 * @langversion 3.0 * * @return The number of milliseconds since Jan 1, 1970 that a Date object represents. * * @includeExample examples\Date.getTime.1.as -noswf * @includeExample examples\Date.getTime.2.as -noswf * * @helpid x208F2 * @refpath Objects/Core/Date/Methods/getTime * @keyword date.gettime, gettime, date */ public native function getTime():Number; /** * Returns the difference, in minutes, between the computer's local time and universal * time (UTC). * * @playerversion Flash 9 * @langversion 3.0 * * @return Difference, in minutes, of local time and universal time (UTC). * * @includeExample examples\Date.getTimezoneOffset.1.as -noswf * * @helpid x208F3 * @refpath Objects/Core/Date/Methods/getTimezoneOffset * @keyword date.gettimezoneoffset, gettimezoneoffset, date */ public native function getTimezoneOffset():Number; /** * Returns the day of the month (an integer from 1 to 31) of a Date object, * according to universal time (UTC). * * @playerversion Flash 9 * @langversion 3.0 * * @return The UTC day of the month (1 to 31) that a Date object represents. * * @includeExample examples\Date.getUTCDate.1.as -noswf * * @see #getDate() * @helpid x208F4 * @refpath Objects/Core/Date/Methods/getUTCDate * @keyword date.getutcdate, getutcdate, date */ public native function getUTCDate():Number; /** * Returns the day of the week (0 for Sunday, 1 for Monday, and so on) of this Date * according to universal time (UTC). * * @playerversion Flash 9 * @langversion 3.0 * * @return The UTC day of the week (0 to 6) that a Date object represents. * * @includeExample examples\Date.getUTCDay.1.as -noswf * * @see #getDay() * @helpid x208F5 * @refpath Objects/Core/Date/Methods/getUTCDay * @keyword date.getutcday, getutcday, date */ public native function getUTCDay():Number; /** * Returns the four-digit year of a Date object according to universal time (UTC). * * @playerversion Flash 9 * @langversion 3.0 * * @return The UTC four-digit year a Date object represents. * * @includeExample examples\Date.getUTCFullYear.1.as -noswf * * @see #getFullYear() * @helpid x208F6 * @refpath Objects/Core/Date/Methods/getUTCFullYear * @keyword date.getutcfullyear, getutcfullyear, date */ public native function getUTCFullYear():Number; /** * Returns the hour (an integer from 0 to 23) of the day of a Date object * according to universal time (UTC). * * @playerversion Flash 9 * @langversion 3.0 * * @return The UTC hour of the day (0 to 23) a Date object represents. * * @includeExample examples\Date.getUTCHours.1.as -noswf * * @see #getHours() * @helpid x208F7 * @refpath Objects/Core/Date/Methods/getUTCHours * @keyword date.getutchours, getutchours, date */ public native function getUTCHours():Number; /** * Returns the milliseconds (an integer from 0 to 999) portion of a Date object * according to universal time (UTC). * * @playerversion Flash 9 * @langversion 3.0 * * @return The UTC milliseconds portion of a Date object. * * @includeExample examples\Date.getUTCMilliseconds.1.as -noswf * * @helpid x208F8 * @refpath Objects/Core/Date/Methods/getUTCMilliseconds * @keyword date.getutcmilliseconds, getutcmilliseconds, date */ public native function getUTCMilliseconds():Number; /** * Returns the minutes (an integer from 0 to 59) portion of a Date object * according to universal time (UTC). * * @playerversion Flash 9 * @langversion 3.0 * * @return The UTC minutes portion of a Date object. * * @includeExample examples\Date.getUTCMinutes.1.as -noswf * * @helpid x208F9 * @refpath Objects/Core/Date/Methods/getUTCMinutes * @keyword date.getutcminutes, getutcminutes, date */ public native function getUTCMinutes():Number; /** * Returns the month (0 [January] to 11 [December]) portion of a Date object * according to universal time (UTC). * * @playerversion Flash 9 * @langversion 3.0 * * @return The UTC month portion of a Date object. * * @includeExample examples\Date.getUTCMonth.1.as -noswf * * @see #getMonth() * @helpid x208FA * @refpath Objects/Core/Date/Methods/getUTCMonth * @keyword date.getutcmonth, getutcmonth, date */ public native function getUTCMonth():Number; /** * Returns the seconds (an integer from 0 to 59) portion of a Date object * according to universal time (UTC). * * @playerversion Flash 9 * @langversion 3.0 * * @return The UTC seconds portion of a Date object. * * @includeExample examples\Date.getUTCSeconds.1.as -noswf * * @helpid x208FB * @refpath Objects/Core/Date/Methods/getUTCSeconds * @keyword date.getutcseconds, getutcseconds, date */ public native function getUTCSeconds():Number; /** * Returns the year of a Date object according to universal time (UTC). The year * is the full year minus 1900. For example, the year 2000 is represented as 100. * @playerversion Flash 9 * @langversion 3.0 * * @return The UTC year a Date object represents. * * @includeExample examples\Date.getUTCYear.1.as -noswf * * @see #getFullYear() * @helpid x208F6 * @refpath Objects/Core/Date/Methods/getUTCFullYear * @keyword date.getutcfullyear, getutcfullyear, date */ public native function getUTCYear():Number; /** * Returns the year of a Date object according to local time. Local time is * determined by the operating system on which Flash Player is running. The year is the * full year minus 1900. For example, the year 2000 is represented as 100. * @playerversion Flash 9 * @langversion 3.0 * * @return An integer. * * @includeExample examples\Date.getYear.1.as -noswf * * @see #getFullYear() * @helpid x208FC * @refpath Objects/Core/Date/Methods/getYear * @keyword date.getyear, getyear, date */ public native function getYear():Number; /** * Converts a string representing a date into a number equaling the number of milliseconds * elapsed since January 1, 1970, UTC. * * @param date A string representation of a date, which conforms to the format for the output of * Date.toString(). The date format for the output of Date.toString() is: *
     * Day Mon Date HH:MM:SS TZD YYYY
     * 
*

For example:

*
     * Wed Apr 12 15:30:17 GMT-0700 2006
     * 
*

Other supported formats include (and you can include partial representations of these, meaning * just the month, day, and year):

*
     * MM/DD/YYYY HH:MM:SS TZD
     * YYYY-MM-DDThh:mm:ssTZD
     * 
* * @return A number representing the milliseconds elapsed since January 1, 1970, UTC. * * @includeExample examples\Date.parse.1.as -noswf * @see #toString() Date.toString() */ public native static function parse(date:String):Number; /** * Sets the day of the month, according to local time, and returns the new time in * milliseconds. Local time is determined by the operating system on which Flash Player * is running. * * @playerversion Flash 9 * @langversion 3.0 * * @param day An integer from 1 to 31. * * @return The new time, in milliseconds. * * @includeExample examples\Date.setDate.1.as -noswf * * @helpid x208FE * @refpath Objects/Core/Date/Methods/setDate * @keyword date.setdate, setdate, date */ public native function setDate(day:Number):Number; /** * Sets the year, according to local time, and returns the new time in milliseconds. If * the month and day parameters are specified, * they are set to local time. Local time is determined by the operating system on which * Flash Player is running. *

* Calling this method does not modify the other fields of the Date but * Date.getUTCDay() and Date.getDay() can report a new value * if the day of the week changes as a result of calling this method. *

* * @playerversion Flash 9 * @langversion 3.0 * * @param year A four-digit number specifying a year. Two-digit numbers do not represent * four-digit years; for example, 99 is not the year 1999, but the year 99. * * @param month An integer from 0 (January) to 11 (December). * * @param day A number from 1 to 31. * * @return The new time, in milliseconds. * * @includeExample examples\Date.setFullYear.1.as -noswf * * @see #getUTCDay() * @see #getDay() * @helpid x208FF * @refpath Objects/Core/Date/Methods/setFullYear * @keyword date.setfullyear, setfullyear, date */ public native function setFullYear(year:Number, month:Number, day:Number):Number; /** * Sets the hour, according to local time, and returns the new time in milliseconds. * Local time is determined by the operating system on which Flash Player is running. * * @playerversion Flash 9 * @langversion 3.0 * * @param hour An integer from 0 (midnight) to 23 (11 p.m.). * @param minute An integer from 0 to 59. * @param second An integer from 0 to 59. * @param millisecond An integer from 0 to 999. * * @return The new time, in milliseconds. * * @includeExample examples\Date.setHours.1.as -noswf * * @helpid x20900 * @refpath Objects/Core/Date/Methods/setHours * @keyword date.sethours, sethours, date */ public native function setHours(hour:Number, minute:Number, second:Number, millisecond:Number):Number; /** * Sets the milliseconds, according to local time, and returns the new time in * milliseconds. Local time is determined by the operating system on which Flash Player * is running. * * @playerversion Flash 9 * @langversion 3.0 * * @param millisecond An integer from 0 to 999. * * @return The new time, in milliseconds. * * @includeExample examples\Date.setMilliseconds.1.as -noswf * * @helpid x20901 * @refpath Objects/Core/Date/Methods/setMilliseconds * @keyword date.setmilliseconds, setmilliseconds, date */ public native function setMilliseconds(millisecond:Number):Number; /** * Sets the minutes, according to local time, and returns the new time in milliseconds. * Local time is determined by the operating system on which Flash Player is running. * * @playerversion Flash 9 * @langversion 3.0 * * @param minute An integer from 0 to 59. * @param second An integer from 0 to 59. * @param millisecond An integer from 0 to 999. * * @return The new time, in milliseconds. * * @includeExample examples\Date.setMinutes.1.as -noswf * * @helpid x20902 * @refpath Objects/Core/Date/Methods/setMinutes * @keyword date.setminutes, setminutes, date */ public native function setMinutes(minute:Number, second:Number, millisecond:Number):Number; /** * Sets the month and optionally the day of the month, according to local time, and * returns the new time in milliseconds. Local time is determined by the operating * system on which Flash Player is running. * * @playerversion Flash 9 * @langversion 3.0 * * @param month An integer from 0 (January) to 11 (December). * * @param day An integer from 1 to 31. * * @return The new time, in milliseconds. * * @includeExample examples\Date.setMonth.1.as -noswf * * @helpid x20903 * @refpath Objects/Core/Date/Methods/setMonth * @keyword date.setmonth, setmonth, date */ public native function setMonth(month:Number, day:Number):Number; /** * Sets the seconds, according to local time, and returns the new time in milliseconds. * Local time is determined by the operating system on which Flash Player is running. * * @playerversion Flash 9 * @langversion 3.0 * * @param second An integer from 0 to 59. * @param millisecond An integer from 0 to 999. * * @return The new time, in milliseconds. * * @includeExample examples\Date.setSeconds.1.as -noswf * * @helpid x20904 * @refpath Objects/Core/Date/Methods/setSeconds * @keyword date.setseconds, setseconds, date */ public native function setSeconds(second:Number, millisecond:Number):Number; /** * Sets the date in milliseconds since midnight on January 1, 1970, and returns the new * time in milliseconds. * * @playerversion Flash 9 * @langversion 3.0 * * @param millisecond An integer value where 0 is midnight on January 1, universal time (UTC). * * @return The new time, in milliseconds. * * @includeExample examples\Date.setTime.1.as -noswf * * @helpid x20905 * @refpath Objects/Core/Date/Methods/setTime * @keyword date.settime, settime, date */ public native function setTime(millisecond:Number):Number; /** * Sets the day of the month, in universal time (UTC), and returns the new time in * milliseconds. Calling this method does not modify the other fields of a Date * object, but the Date.getUTCDay() and Date.getDay() methods can report * a new value if the day of the week changes as a result of calling this method. * * @playerversion Flash 9 * @langversion 3.0 * * @param day A number; an integer from 1 to 31. * * @return The new time, in milliseconds. * * @includeExample examples\Date.setUTCDate.1.as -noswf * * @see #getUTCDay() * @see #getDay() * @helpid x20906 * @refpath Objects/Core/Date/Methods/setUTCDate * @keyword date.setutcdate, setutcdate, date */ public native function setUTCDate(day:Number):Number; /** * Sets the year, in universal time (UTC), and returns the new time in milliseconds. *

* Optionally, this method can also set the month and day of the month. Calling * this method does not modify the other fields, but the Date.getUTCDay() and * Date.getDay() methods can report a new value if the day of the week changes as a * result of calling this method. *

* * @playerversion Flash 9 * @langversion 3.0 * * @param year An integer that represents the year specified as a full four-digit year, * such as 2000. * * @param month An integer from 0 (January) to 11 (December). * * @param day An integer from 1 to 31. * * @return An integer. * * @includeExample examples\Date.setUTCFullYear.1.as -noswf * * @see #getUTCDay() * @see #getDay() * @helpid x20907 * @refpath Objects/Core/Date/Methods/setUTCFullYear * @keyword date.setutcfullyear, setutcfullyear, date */ public native function setUTCFullYear(year:Number, month:Number, day:Number):Number; /** * Sets the hour, in universal time (UTC), and returns the new time in milliseconds. * Optionally, the minutes, seconds and milliseconds can be specified. * * @playerversion Flash 9 * @langversion 3.0 * * @param hour An integer from 0 (midnight) to 23 (11 p.m.). * * @param minute An integer from 0 to 59. * * @param second An integer from 0 to 59. * * @param millisecond An integer from 0 to 999. * * @return The new time, in milliseconds. * * @includeExample examples\Date.setUTCHours.1.as -noswf * * @helpid x20908 * @refpath Objects/Core/Date/Methods/setUTCHours * @keyword date.setutchours, setutchours, date */ public native function setUTCHours(hour:Number, minute:Number, second:Number, millisecond:Number):Number; /** * Sets the milliseconds, in universal time (UTC), and returns the new time in milliseconds. * * @playerversion Flash 9 * @langversion 3.0 * * @param millisecond An integer from 0 to 999. * * @return The new time, in milliseconds. * * @includeExample examples\Date.setUTCMilliseconds.1.as -noswf * * @helpid x20909 * @refpath Objects/Core/Date/Methods/setUTCMilliseconds * @keyword date.setutcmilliseconds, setutcmilliseconds, date */ public native function setUTCMilliseconds(millisecond:Number):Number; /** * Sets the minutes, in universal time (UTC), and returns the new time in milliseconds. * Optionally, you can specify the seconds and milliseconds. * * @playerversion Flash 9 * @langversion 3.0 * * @param minute An integer from 0 to 59. * * @param second An integer from 0 to 59. * * @param millisecond An integer from 0 to 999. * * @return The new time, in milliseconds. * * @includeExample examples\Date.setUTCMinutes.1.as -noswf * * @helpid x2090A * @refpath Objects/Core/Date/Methods/setUTCMinutes * @keyword date.setutcminutes, setutcminutes, date */ public native function setUTCMinutes(minute:Number, second:Number, millisecond:Number):Number; /** * Sets the month, and optionally the day, in universal time(UTC) and returns the new * time in milliseconds. Calling this method does not modify the other fields, but the * Date.getUTCDay() and Date.getDay() methods might report a new * value if the day of the week changes as a result of calling this method. * * @playerversion Flash 9 * @langversion 3.0 * * @param month An integer from 0 (January) to 11 (December). * * @param day An integer from 1 to 31. * * @return The new time, in milliseconds. * * @includeExample examples\Date.setUTCMonth.1.as -noswf * * @see #getDay() * @helpid x2090B * @refpath Objects/Core/Date/Methods/setUTCMonth * @keyword date.setutcmonth, setutcmonth, date */ public native function setUTCMonth(month:Number, day:Number):Number; /** * Sets the seconds, and optionally the milliseconds, in universal time (UTC) and * returns the new time in milliseconds. * * @playerversion Flash 9 * @langversion 3.0 * * @param second An integer from 0 to 59. * * @param millisecond An integer from 0 to 999. * * @return The new time, in milliseconds. * * @includeExample examples\Date.setUTCSeconds.1.as -noswf * * @helpid x2090C * @refpath Objects/Core/Date/Methods/setUTCSeconds * @keyword date.setutcseconds, setutcseconds, date */ public native function setUTCSeconds(second:Number, millisecond:Number):Number; /** * Sets the year, in local time, and returns the new time in milliseconds. Local time is * determined by the operating system on which Flash Player is running. * @playerversion Flash 9 * @langversion 3.0 * * @param year A number that represents the year. If year is an * integer between 0 and 99, setYear sets the year at 1900 + * year; otherwise, the year is the value of the year * parameter. * * @return The new time, in milliseconds. * * @includeExample examples\Date.setYear.1.as -noswf * * @helpid x2090D * @refpath Objects/Core/Date/Methods/setYear * @keyword date.setyear, setyear, date */ public native function setYear(year:Number):Number; /** * Returns a string representation of the day and date only, and does not include the time or timezone. * Contrast with the following methods: * * * @playerversion Flash 9 * @langversion ActionScript 3.0 * * @return The string representation of day and date only. * * @includeExample examples\Date.toDateString.1.as -noswf * * @see #toString() */ public native function toDateString():String; /** * Returns a String representation of the time and timezone only, and does not include the day and date. * Contrast with the Date.toDateString() method, which returns only the day and date. * * @playerversion Flash 9 * @langversion ActionScript 3.0 * * @return The string representation of time and timezone only. * * @see #toDateString() */ public native function toTimeString():String; /** * Returns a String representation of the day, date, time, given in local time. * Contrast with the Date.toString() method, which returns the same information (plus the timezone) * with the year listed at the end of the string. * * @playerversion Flash 9 * @langversion 3.0 * * @return A string representation of a Date object in the local timezone. * */ public native function toLocaleString():String; /** * Returns a String representation of the day and date only, and does not include the time or timezone. * This method returns the same value as Date.toDateString. * Contrast with the following methods: * * * @playerversion Flash 9 * @langversion ActionScript 3.0 * * @return The String representation of day and date only. * * @see #toDateString() * @see #toTimeString() * @see #toString() */ public native function toLocaleDateString():String; /** * Returns a String representation of the time only, and does not include the day, date, year or timezone. * Contrast with the Date.toTimeString() method, which returns the time and timezone. * * @playerversion Flash 9 * @langversion ActionScript 3.0 * * @return The string representation of time and timezone only. * * @see #toTimeString() */ public native function toLocaleTimeString():String; /** * Returns a String representation of the day, date, and time in universal time (UTC). * For example, the date February 1, 2005 is returned as Tue Feb 1 00:00:00 2005 UTC. * * @playerversion Flash 9 * @langversion 3.0 * * @return The string representation of a Date object in UTC time. * * @see #toString() */ public native function toUTCString():String; /** * Returns a String representation of the day, date, time, and timezone. * The date format for the output is: *
     * Day Mon Date HH:MM:SS TZD YYYY
     * 
*

For example:

*
     * Wed Apr 12 15:30:17 GMT-0700 2006
     * 
* * @playerversion Flash 9 * @langversion 3.0 * * @return The string representation of a Date object. * * @includeExample examples\Date.toString.1.as -noswf * * @helpid x2090E * @refpath Objects/Core/Date/Methods/toString * @keyword date.tostring, tostring, date */ public native function toString():String; /** * Returns the number of milliseconds since midnight January 1, 1970, universal time, * for a Date object. * * @playerversion Flash 9 * @langversion 3.0 * * @return The number of milliseconds since January 1, 1970 that a Date object represents. * * @includeExample examples\Date.valueOf.1.as -noswf * * @helpid * @refpath Objects/Core/Date/Methods/valueOf * @keyword date.valueof, valueof, date */ public native function valueOf():Number; } } package { //**************************************************************************** // ActionScript Standard Library // DefinitionError object //**************************************************************************** /** * The DefinitionError class represents an error that occurs whenever user code * attempts to define an identifier that is already defined. Common cases * where this error occurs include redefining classes, interfaces, * or functions. * * @tiptext An DefinitionError is thrown when code attempts to redefine a class, * interface, or function. * * @includeExample * * @playerversion Flash 9 * @langversion 3.0 * @helpid */ public dynamic class DefinitionError extends Error { /** * Creates a new DefinitionError object. */ public native function DefinitionError(message:String = ""); } } package flash.errors { /** * An EOFError exception is thrown when you attempt to read past the end of the available data. For example, an * EOFError is thrown when one of the read methods in the IDataInput interface is * called and there is insufficient data to satisfy the read request. * * @includeExample examples\EOFErrorExample.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * * @see flash.utils.ByteArray * @see flash.utils.IDataInput * @see flash.net.Socket * @see flash.net.URLStream * @helpid * @refpath * @keyword Error */ public dynamic class EOFError extends IOError { /** * Creates a new EOFError object. * * @param message A string associated with the error object. * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword **/ function EOFError(message:String = "") { super(message); } } } package { //**************************************************************************** // ActionScript Standard Library // Error object //**************************************************************************** /** * Contains information about an error that occurred in a script. While developing ActionScript 3.0 applications, * you can run your compiled code and Flash Player will display exceptions of type Error, or of a subclass, * in a dialog box at runtime to help you troubleshoot the code. * You create an Error object using the Error constructor function. * Typically, you throw a new Error object from within a try * code block that is then caught by a catch or finally code block. *

You can also create a subclass of the Error class and throw instances of that subclass.

* * @includeExample examples\ErrorExample.as -noswf * * @tiptext An Error is thrown when an error occurs in a script. * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword Error */ public dynamic class Error extends Object { /** * The default number of arguments for the constructor. You can specify 1 or no arguments. For details, see the Error() constructor function. * @playerversion Flash 9 * @langversion 3.0 * @see #Error() */ public static const length:int = 1; /** * Contains the reference number associated with the specific error message. For a custom Error object * this number is the value from the id parameter supplied in the constructor. * @return The error code number for a specific error message. * * @playerversion Flash 9 * @langversion 3.0 * * @tiptext Contains the error number. * * * @helpid * @refpath * @keyword Error.errorID, errorID */ public native function get errorID():int; /** * Contains the message associated with the Error object. By default, the value of this property * is "Error". You can specify a message property when you create an * Error object by passing the error string to the Error constructor function. * * * @playerversion Flash 9 * @langversion 3.0 * * @tiptext Contains the error message associated with the Error instance. * * @oldexample In the following example, a method throws errors based on the * parameters passed to it. If either of the parameters is unspecified an instance of * the Error class with an appropriate message is thrown. If the second parameter is * zero an error with a different message gets thrown: *
	 * function divideNum(num1:Number, num2:Number):Number {
	 *   if (isNaN(num1) || isNaN(num2)) {
	 *     throw new Error("divideNum function requires two numeric parameters.");
	 *   } else if (num2 == 0) {
	 *     throw new Error("cannot divide by zero.");
	 *   }
	 *   return num1/num2;
	 * }
	 * try {
	 *   var theNum:Number = divideNum(1, 0);
	 *   trace("SUCCESS! "+theNum);
	 * } catch (e_err:Error) {
	 *   trace("ERROR! "+e_err.message);
	 *   trace("\t"+e_err.name);
	 * }
	 * 
* If you test this ActionScript with the specified parameters, an error message * displays indicating that you are attempting to divide by 0. * * @see statements.html#throw * @see statements.html#try..catch..finally * * @helpid * @refpath * @keyword Error.message, message */ public var message:String; /** * Contains the name of the Error object. By default, the value of this property is "Error". * * @playerversion Flash 9 * @langversion 3.0 * * @tiptext The name of the Error instance. * * @oldexample In the following example, a function throws a specified error depending on the two numbers that you try to divide. Add the following ActionScript to Frame 1 of the Timeline: *
	 * function divideNumber(numerator:Number, denominator:Number):Number {
	 *   if (isNaN(numerator) || isNaN(denominator)) {
	 *     throw new Error("divideNum function requires two numeric parameters.");
	 *   } else if (denominator == 0) {
	 *     throw new DivideByZeroError();
	 *   }
	 *   return numerator/denominator;
	 * }
	 * try {
	 *   var theNum:Number = divideNumber(1, 0);
	 *   trace("SUCCESS! "+theNum);
	 *   // output: DivideByZeroError -> Unable to divide by zero.
	 * } catch (e_err:DivideByZeroError) {
	 *   // divide by zero error occurred
	 *   trace(e_err.name+" -> "+e_err.toString());
	 * } catch (e_err:Error) {
	 *   // generic error occurred
	 *   trace(e_err.name+" -> "+e_err.toString());
	 * }
	 * 
*

In the following example, we define a custom Error class called * DivideByZeroError:

*
	 * class DivideByZeroError extends Error {
	 *   public DivideByZeroError() {
	 *   		super ("Unable to divide by zero.");
	 * 	 	name = "DivideByZeroError";
	 * 		}
	 * }
	 * 
*

The following method then throws the custom error when it detects the * appropriate error conditions:

*
	 * function divideNumbers(num1:Number, num2:Number) { etc.
	 * 
* * @see statements.html#throw * @see statements.html#try..catch..finally * * @helpid * @refpath * @keyword Error.name, name */ public var name:String; /** * Creates a new Error object. If message is specified, its value is assigned * to the object's Error.message property. * * * @playerversion Flash 9 * @langversion 3.0 * * @tiptext Creates a new Error instance with the specified error message. * * @param message A string associated with the Error object; this parameter * is optional. * @param id A reference number to associate with the specific error message. * * @return A reference to an Error object. * * @includeExample examples\Error.1.as -noswf * * @oldexample In the following example, a function throws an error (with a specified message) if the two strings that are passed to it are not identical: *
	 * function compareStrings(str1_str:String, str2_str:String):void {
	 *   if (str1_str != str2_str) {
	 *     throw new Error("Strings do not match.");
	 *   }
	 * }
	 * try {
	 *   compareStrings("Dog", "dog");
	 *   // output: Strings do not match.
	 * } catch (e_err:Error) {
	 *   trace(e_err.toString());
	 * }
	 * 
* * @see statements.html#throw * @see statements.html#try..catch..finally * * @helpid * @refpath * @keyword Error, constructor */ public native function Error(message:String = "", id:int = 0); /** * For debugger versions of the Flash Player, only; this method returns the call stack for an error * as a string at the time of the error's construction. The first line of the return value is the * string representation of the exception object, followed by the strack trace elements. For example: * * TypeError: null cannot be converted to an object * at com.xyz.OrderEntry.retrieveData(OrderEntry.as:995) * at com.xyz.OrderEntry.init(OrderEntry.as:200) * at com.xyz.OrderEntry.$construct(OrderEntry.as:148) * * * * @playerversion Flash 9 * @langversion 3.0 * * @tiptext Returns the call stack for an error in a readable form. * * * @return A string representation of the call stack. * * * * @helpid * @refpath * @keyword Error, call stack */ public native function getStackTrace():String /** * * Returns the string "Error" by default or the value contained in Error.message, if defined. * * @playerversion Flash 9 * @langversion 3.0 * * @tiptext Returns the error message, or the word "Error" if the message is * undefined. * * @return The error message. * * @includeExample examples\Error.toString.1.as -noswf * * @oldexample In the following example, a function throws an error (with a specified message) if the two strings that are passed to it are not identical: *
	* function compareStrings(str1_str:String, str2_str:String):void {
	* if (str1_str != str2_str) {
	*   throw new Error("Strings do not match.");
	* 	}
	* }
	* try {
	* 	compareStrings("Dog", "dog");
	* 	// output: Strings do not match.
	* } catch (e_err:Error) {
	* 	trace(e_err.toString());
	* }
	* 
* * @see #message Error.message * @see statements.html#throw * @see statements.html#try..catch..finally * * @helpid * @refpath * @keyword Error.toString, toString */ override native public function toString():String; } } package { //**************************************************************************** // ActionScript Standard Library // EvalError object //**************************************************************************** /** * The EvalError class represents an error that occurs whenever user code * calls the eval() function or attempts to use the new * operator with a Function object. Neither calling eval() nor * calling new with a Function object is supported. * * @tiptext An EvalError is thrown when code attempts to call eval() or use new with * a Function object. * * @includeExample * * @playerversion Flash 9 * @langversion 3.0 * @helpid */ public dynamic class EvalError extends Error { /** * Creates a new EvalError object. */ public native function EvalError(message:String = ""); } } package { //**************************************************************************** // ActionScript Standard Library // Function object //**************************************************************************** /** * A Function is the basic unit of code that can be invoked in ActionScript. * Both user-defined and built-in functions in ActionScript are represented by Function objects, * which are instances of the Function class. *

Methods of a class are slightly different than Function objects. Unlike an ordinary function object, a method is tightly linked to its associated class object. So, a method or property has a definition that is shared among all instances of the same class. Methods can be extracted from an instance and treated as "bound methods" (retaining the link to the original instance). For a bound method, the this keyword points to the original object that implemented the method. For a function, this points to the associated object at the time the function is invoked.

* * * @playerversion Flash 9 * @langversion 3.0 * * @includeExample examples\FunctionExample.as -noswf * * @tiptext The Function class is used to represent a built-in or user-defined function. * * @helpid * @refpath * @keyword Function, Function object, built-in class */ dynamic public class Function { /** */ public var prototype:Object; /** * Specifies the value of thisObject to be used within any function that ActionScript calls. * This method also specifies the parameters to be passed to any called function. Because apply() * is a method of the Function class, it is also a method of every Function object in ActionScript. *

The parameters are specified as an Array object, unlike Function.call(), which specifies * parameters as a comma-delimited list. This is often useful when the number of parameters to be passed is not * known until the script actually executes.

*

Returns the value that the called function specifies as the return value.

* * @playerversion Flash 9 * @langversion 3.0 * * @tiptext Specifies the object instance on which the Function is called. * * @param thisObject The object to which myFunction is applied. * * @param argArray An array whose elements are passed to myFunction as parameters. * * @return Any value that the called function specifies. * * * @oldexample The following function invocations are equivalent: *
  * Math.atan2(1, 0)
  * Math.atan2.apply(null, [1, 0])
  * 
*

The following simple example shows how apply() passes an array of parameters:

*
  * function theFunction() {
  * 	trace(arguments);
  * }
  * 
  * // create a new array to pass as a parameter to apply()
  * var firstArray:Array = new Array(1,2,3);
  * theFunction.apply(null,firstArray);
  * // outputs: 1,2,3
  * 
  * // create a second array to pass as a parameter to apply()
  * var secondArray:Array = new Array("a", "b", "c");
  * theFunction.apply(null,secondArray);
  * // outputs a,b,c
  * 
*

The following example shows how apply() passes an array of parameters and specifies the value of this:

*
  * // define a function 
  * function theFunction() {
  * 	trace("this == myObj? " + (this == myObj));
  * 	trace("arguments: " + arguments);
  * }
  * 
  * // instantiate an object
  * var myObj:Object = new Object();
  * 
  * // create arrays to pass as a parameter to apply()
  * var firstArray:Array = new Array(1,2,3);
  * var secondArray:Array = new Array("a", "b", "c");
  * 
  * // use apply() to set the value of this to be myObj and send firstArray
  * theFunction.apply(myObj,firstArray);
  * // output: 
  * // this == myObj? true
  * // arguments: 1,2,3
  * 
  * // use apply() to set the value of this to be myObj and send secondArray
  * theFunction.apply(myObj,secondArray);
  * // output: 
  * // this == myObj? true
  * // arguments: a,b,c
  * 
* * @see #call() Function.call() * @helpid * @refpath * @keyword Function, Function.apply, apply */ public native function apply(thisObject:Object,argArray:Array = null): void; /** * Invokes the function represented by a Function object. Every function in ActionScript * is represented by a Function object, so all functions support this method. *

In almost all cases, the function call (()) operator can be used instead of this method. * The function call operator produces code that is concise and readable. This method is primarily useful * when the thisObject parameter of the function invocation needs to be explicitly controlled. * Normally, if a function is invoked as a method of an object, within the body of the function, thisObject * is set to myObject, as shown in the following example:

* * myObject.myMethod(1, 2, 3); * *

In some situations, you might want thisObject to point somewhere else; * for example, if a function must be invoked as a method of an object, but is not actually stored as a method * of that object:

* * myObject.myMethod.call(myOtherObject, 1, 2, 3); * *

You can pass the value null for the thisObject parameter to invoke a function as a * regular function and not as a method of an object. For example, the following function invocations are equivalent:

* * Math.sin(Math.PI / 4) * Math.sin.call(null, Math.PI / 4) * * *

Returns the value that the called function specifies as the return value.

* * @playerversion Flash 9 * @langversion 3.0 * * @tiptext Invokes this Function. * * @param thisObject An object that specifies the value of thisObject within the function body. * * @param parameter1 A parameter to be passed to the myFunction. You can specify zero or more parameters. * * @oldexample The following example uses Function.call() to make a function behave as a method of another object, without storing the function in the object: *
  * function myObject() {
  * }
  * function myMethod(obj) {
  *   trace("this == obj? " + (this == obj));
  * }
  * var obj:Object = new myObject();
  * myMethod.call(obj, obj);
  * 
*

The trace() statement displays:

*

The trace() statement sends the following code to the log file:

*
  * this == obj? true
  * 
* * @see #apply() Function.apply() * @helpid * @refpath * @keyword Function, Function.call, call */ public native function call(thisObject:Object, parameter1:String = null): void; /** */ public native function toString():String; } } package { // Top Level functions /** * Creates a new array. The array can be of length zero or more, or an array populated by a list of * specified elements, possibly of different data types. The number and data type of * the arguments you use determine the contents of the returned array. * * Using the Array() function is similar to creating an array with the Array class constructor. *

Use the as operator for explicit type conversion, or type casting, * when the argument is not a primitive value. For more information, see the Example * section of this entry.

* @includeExample examples\Array.func.4.as -noswf * @includeExample examples\Array.func.5.as -noswf * @param args You can pass no arguments for an empty array, a single integer argument for an array of a specific length, or a series of comma-separated values of various types for an array populated with those values. * @return An array of length zero or more. * @see Array Array class * @see operators.html#as as operator */ public native function Array(...args):Array /** * Converts the expression parameter to a Boolean value and returns the value. *

The return value depends on the data type and value of the argument, as described in the following table:

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Input ValueExampleReturn Value
00false
NaNNaNfalse
Number (not 0 or NaN)4true
Empty string""false
Non-empty string"6"true
nullnullfalse
undefinedundefinedfalse
instance of Object classvar obj:Object = new Object();
Boolean(obj)
true
No argumentBoolean()false
*

Unlike previous versions of ActionScript, the Boolean() function returns the same results as does the Boolean class constructor.

* @param expression An expression or object to convert to Boolean. * @return The result of the conversion to Boolean. */ public native function Boolean(expression:Object):Boolean /** * Decodes an encoded URI into a string. Returns a string in which all characters previously encoded * by the encodeURI function are restored to their unencoded representation. *

The following table shows the set of escape sequences that are not decoded to characters by the decodeURI function. Use decodeURIComponent() to decode the escape sequences in this table.

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Escape sequences not decodedCharacter equivalents
%23#
%24$
%26&
%2B+
%2C,
%2F/
%3A:
%3B;
%3D=
%3F?
%40@
* @param uri A string encoded with the encodeURI function. * @return A string in which all characters previously escaped by the encodeURI function are * restored to their unescaped representation. * @includeExample examples\DecodeURIExample.as -noswf * @see global#decodeURIComponent() * @see global#encodeURI() * @see global#encodeURIComponent() */ public native function decodeURI(uri:String):String /** * Decodes an encoded URI component into a string. Returns a string in which * all characters previously escaped by the encodeURIComponent * function are restored to their uncoded representation. *

This function differs from the decodeURI() function in that it is intended for use only with a part of a URI string, called a URI component. * A URI component is any text that appears between special characters called component separators ( ":", "/", ";" and "?" ). * Common examples of a URI component are "http" and "www.adobe.com".

*

Another important difference between this function and decodeURI() is that because this function * assumes that it is processing a URI component it treats the escape sequences that represent special separator characters (; / ? : @ & = + $ , #) as regular * text that should be decoded.

* @param uri A string encoded with the encodeURIComponent function. * @return A string in which all characters previously escaped by the encodeURIComponent function are * restored to their unescaped representation. * @see global#decodeURI() * @see global#encodeURI() * @see global#encodeURIComponent() */ public native function decodeURIComponent(uri:String):String /** * Encodes a string into a valid URI (Uniform Resource Identifier). * Converts a complete URI into a string in which all characters are encoded * as UTF-8 escape sequences unless a character belongs to a small group of basic characters. *

The following table shows the entire set of basic characters that are not converted to UTF-8 escape sequences by the encodeURI function.

* * * * * * * * * * * * * * * * * * * *
Characters not encoded
0 1 2 3 4 5 6 7 8 9
a b c d e f g h i j k l m n o p q r s t u v w x y z
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
; / ? : @ & = + $ , #
- _ . ! ~ ~~ ' ( )
* @param uri A string representing a complete URI. * @return A string with certain characters encoded as UTF-8 escape sequences. * @includeExample examples\EncodeURIExample.as -noswf * @see global#decodeURI() * @see global#decodeURIComponent() * @see global#encodeURIComponent() */ public native function encodeURI(uri:String):String /** * Encodes a string into a valid URI component. Converts a substring of a URI into a * string in which all characters are encoded as UTF-8 escape sequences unless a character * belongs to a very small group of basic characters. *

The encodeURIComponent() function differs from the encodeURI() function in that it is intended for use only with a part of a URI string, called a URI component. * A URI component is any text that appears between special characters called component separators ( ":", "/", ";" and "?" ). * Common examples of a URI component are "http" and "www.adobe.com".

*

Another important difference between this function and encodeURI() is that because this function * assumes that it is processing a URI component it treats the special separator characters (; / ? : @ & = + $ , #) as regular * text that should be encoded.

*

The following table shows all characters that are not converted to UTF-8 escape sequences by the encodeURIComponent function.

* * * * * * * * * * * * * * * * *
Characters not encoded
0 1 2 3 4 5 6 7 8 9
a b c d e f g h i j k l m n o p q r s t u v w x y z
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
- _ . ! ~ ~~ ' ( )
* @see global#decodeURI() * @see global#decodeURIComponent() * @see global#encodeURI() */ public native function encodeURIComponent(uri:String):String /** * Converts the parameter to a string and encodes it in a URL-encoded format, * where most nonalphanumeric characters are replaced with % hexadecimal sequences. * When used in a URL-encoded string, the percentage symbol (%) is used to introduce * escape characters, and is not equivalent to the modulo operator (%). *

The following table shows all characters that are not converted to escape sequences by the escape() function.

* * * * * * * * * * * * * * * * *
Characters not encoded
0 1 2 3 4 5 6 7 8 9
a b c d e f g h i j k l m n o p q r s t u v w x y z
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
@ - _ . ~~ + /
* @param str The expression to convert into a string and encode in a URL-encoded format. * @return A URL-encoded string. * @see global#unescape() */ public native function escape(str:String):String /** * Converts a given numeric value to an integer value. Decimal values are truncated at the decimal point. * @param value A value to be converted to an integer. * @return The converted integer value. * @see global#uint() */ public native function int(value:Number):int /** * Returns true if the value is a finite number, * or false if the value is Infinity or -Infinity. * The presence of Infinity or -Infinity indicates a mathematical * error condition such as division by 0. * @param num A number to evaluate as finite or infinite. * @return Returns true if it is a finite number * or false if it is infinity or negative infinity. */ public native function isFinite(num:Number):Boolean /** * Returns true if the value is NaN(not a number). The isNaN() function is useful for checking whether a mathematical expression evaluates successfully to a number. The NaN value is a special member of the Number data type that represents a value that is "not a number." *

Note: The NaN value is not a member of the int or uint data types.

*

The following table describes the return value of isNaN() on various input types and values.

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Input Type/ValueExampleReturn Value
0 divided by 0isNaN(0/0)true
Non-zero number divided by 0isNaN(5/0)false
Square root of a negative numberisNaN(Math.sqrt(-1))true
Arcsine of number greater than 1 or less than 0isNaN(Math.asin(2))true
String that can be converted to NumberisNaN("5")false
String that cannot be converted to NumberisNaN("5a")true
* @param num A numeric value or mathematical expression to evaluate. * @return Returns true if the value is NaN(not a number) and false otherwise. */ public native function isNaN(num:Number):Boolean /** * Determines whether the specified string is a valid name for an XML element or attribute. * @param str A string to evaluate. * @return Returns true if the str argument is a valid XML name; false otherwise. */ public native function isXMLName(str:String):Boolean /** * Converts a given value to a Number value. The following table shows the result of various input types: *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Input Type/ValueExampleReturn Value
undefinedNumber(undefined)NaN
nullNumber(null)0
trueNumber(true)1
falseNumber(false)0
NaNNumber(NaN)NaN
Empty stringNumber("")0
String that converts to NumberNumber("5")The number (e.g. 5)
String that does not convert to NumberNumber("5a")NaN
* @param value A value to be converted to a number. * @return The converted number value. */ public native function Number(expression:Object):Number /** * Every value in ActionScript 3.0 is an object, which means that calling Object() on a value returns that value. * @param value An object or a number, string, or Boolean value to convert. * @return The value specified by the value parameter. */ public native function Object(value:Object):Object /** * Converts a string to an integer. If the specified string in the parameters cannot be converted to a number, the function returns NaN. Strings beginning with 0x are interpreted as hexadecimal numbers. Unlike in previous versions of ActionScript, integers beginning with 0 are not interpreted as octal numbers. You must specify a radix of 8 for octal numbers. White space and zeroes preceding valid integers is ignored, as are trailing nonnumeric characters. * @param str A string to convert to an integer. * @param radix An integer representing the radix (base) of the number to parse. Legal values are from 2 to 36. * @return A number or NaN (not a number). */ public native function parseInt(str:String, radix:uint=0):Number /** * Converts a string to a floating-point number. The function reads, or parses, and returns the numbers in a string until it reaches a character that is not a part of the initial number. If the string does not begin with a number that can be parsed, parseFloat() returns NaN. White space preceding valid integers is ignored, as are trailing nonnumeric characters. * @param str The string to read and convert to a floating-point number. * @return A number or NaN (not a number). */ public native function parseFloat(str:String):Number /** * Returns a string representation of the specified parameter. *

The following table shows the result of various input types:

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Input Type/ValueReturn Value
undefinedundefined
null"null"
true"true"
false"false"
NaN"NaN"
StringString
ObjectObject.toString()
NumberString representation of the number
* @param expression An expression to convert to a string. * @return A string representation of the value passed for the expression parameter. */ public native function String(expression:Object):String /** * Evaluates the parameter str as a string, decodes the string from URL-encoded format * (converting all hexadecimal sequences to ASCII characters), and returns the string. * @param str A string with hexadecimal sequences to escape. * @return A string decoded from a URL-encoded parameter. */ public native function unescape(str:String):String /** * Converts a given numeric value to an unsigned integer value. Decimal values are truncated at the decimal point. *

The following table describes the return value of uint() on various input types and values.

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Input Type/ValueExampleReturn Value
undefineduint(undefined)0
nulluint(null)0
0uint(0)0
NaNuint(NaN)0
Positive floating point numberuint(5.31)Truncated unsigned integer (e.g. 5)
Negative floating point numberuint(-5.78)Truncates to integer then applies rule for negative integers
Negative integeruint(-5)Sum of uint.MAX_VALUE and the negative integer (e.g. uint.MAX_VALUE + (-5))
trueuint(true)1
falseuint(false)0
Empty Stringuint("")0
String that converts to Numberuint("5")See rules for Numbers in this table
String that does not convert to Numberuint("5a")0
* @param value A value to be converted to an integer. * @return The converted integer value. * @see global#int() */ public native function uint(value:Number):uint /** * Converts an object to an XML object. *

The following table describes return values for various input types.

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Parameter TypeReturn Value
BooleanValue is first converted to a string, then converted to an XML object.
NullA runtime error occurs (TypeError exception).
NumberValue is first converted to a string, then converted to an XML object.
ObjectConverts to XML only if the value is a String, Number or Boolean value. Otherwise a runtime error occurs (TypeError exception).
StringValue is converted to XML.
UndefinedA runtime error occurs (TypeError exception).
XMLInput value is returned unchanged.
XMLListReturns an XML object only if the XMLList object contains only one property of type XML. Otherwise a runtime error occurs (TypeError exception).
* @param expression Object to be converted to XML. * @return An XML object containing values held in the converted object. * @see global#XMLList() */ public native function XML(expression:Object):XML /** * Converts an object to an XMLList object, as described in the following table. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Parameter TypeReturn Value
BooleanValue is first converted to a string, then converted to an XMLList object.
NullA runtime error occurs (TypeError exception).
NumberValue is first converted to a string, then converted to an XMLList object.
ObjectConverts to XMLList only if the value is a String, Number or Boolean value. Otherwise a runtime error occurs (TypeError exception).
StringValue is converted to an XMLList object.
UndefinedA runtime error occurs (TypeError exception).
XMLValue is converted to an XMLList object.
XMLListInput value is returned unchanged.
* @param expression Object to be converted into an XMLList object. * @return An XMLList object containing values held in the converted object. * @see global#XML() */ public native function XMLList(expression:Object):XMLList } package flash.errors { /** * The IllegalOperationError exception is thrown when a method is not implemented or the * implementation doesn't cover the current usage. * * Examples of illegal operation error exceptions include: * * * * * @includeExample examples\IllegalOperationErrorExample.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword Error */ public dynamic class IllegalOperationError extends Error { /** * Creates a new IllegalOperationError object. * * @param message A string associated with the error object. * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword **/ function IllegalOperationError(message:String = "") { super(message); } } } package { /** * A data type representing a 32-bit signed integer. * The range of values represented by the int class is -2,147,483,648 (-2^31) to 2,147,483,647 (2^31-1). *

The properties of the int class are static, which means you do not need an object to use them, so you do not need to use the constructor. The methods, however, are not static, which means that you do need an object to use them. You can create an int object by using the int class constructor or by declaring a variable of type int and assigning the variable a literal value.

*

The int data type is useful for loop counters and other situations where a floating point number is not needed, and is similar to the int data type in Java and C++. The default value of a variable typed as int is 0

*

If you are working with numbers that exceed int.MAX_VALUE, consider using Number.

*

The following example calls the toString() method of the int class, which returns the string 1234:

* * var myint:int = 1234; * myint.toString(); * *

The following example assigns the value of the MIN_VALUE property to a variable declared without the use of the constructor:

*
 * var smallest:int = int.MIN_VALUE;
 * 
* * @includeExample examples\IntExample.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * * @see uint.html uint * @see Number.html Number * @helpid x2097D * @refpath Objects/Core/int * @keyword int object, int, built-in class */ public final class int { /** * The largest representable 32-bit signed integer, which is 2,147,483,647. * * @playerversion Flash 9 * @langversion 3.0 * * * @example The following ActionScript displayswrites the largest and smallest representable ints to the Output panelto the log file: *
	* trace("int.MIN_VALUE = "+int.MIN_VALUE);
	* trace("int.MAX_VALUE = "+int.MAX_VALUE);
	* 
*

This code logsdisplays the following values:

*
	* int.MIN_VALUE = -2147483648
	* int.MAX_VALUE = 2147483647
	* 
* * * @helpid x20964 * @refpath Objects/Core/int/Constants/MAX_VALUE * @keyword int, int.max_value, max_value, max value */ public static const MAX_VALUE:int = 2147483647; /** * The smallest representable 32-bit signed integer, which is -2,147,483,648. * * @playerversion Flash 9 * @langversion 3.0 * * @example The following ActionScript displayswrites the largest and smallest representable ints to the Output panel to the log file: *
     * trace("int.MIN_VALUE = "+int.MIN_VALUE);
     * trace("int.MAX_VALUE = "+int.MAX_VALUE);
     * 
*

This code logsdisplays the following values:

*
	* int.MIN_VALUE = -2147483648
	* int.MAX_VALUE = 2147483647
     * 
* * * @helpid x2096B * @refpath Objects/Core/int/Constants/MIN_VALUE * @keyword int, int.min_value, min_value, min value */ public static const MIN_VALUE:int = -2147483648; /** * Constructor; creates a new int object. You must use the int constructor when using int.toString() and int.valueOf(). You do not use a constructor when using the properties of a int object. The new int constructor is primarily used as a placeholder. A int object is not the same as the int() function that converts a parameter to a primitive value. * * @playerversion Flash 9 * @langversion 3.0 * * * @param num The numeric value of the int object being created or a value to be converted to a number. The default value is 0 if value is not provided. * * @return A reference to a int object. * * @example The following code constructs new int objects: *
	 * var n1:int = new int(3.4);
	 * var n2:int = new int(-10);
	 * 
* * * @see int#toString() * @see int#valueOf() * @helpid x2097C * @refpath Objects/Core/int/new int * @keyword new number, constructor */ public native function int(num:Object); /** * Returns the string representation of an int object. * * @playerversion Flash 9 * @langversion 3.0 * * @param radix Specifies the numeric base (from 2 to 36) to use for the number-to-string conversion. If you do not specify the radix parameter, the default value is 10. * * @return A string. * * @example The following example uses 2 and 8 for the radix parameter and returns a string that contains the corresponding representation of the number 9: *
	 * var myint:int = new int(9);
	 * trace(myint.toString(2)); // output: 1001
	 * trace(myint.toString(8)); // output: 11
	 * 
*

The following example results in a hexadecimal value.

*
	 * var r:int = new int(250);
	 * var g:int = new int(128);
	 * var b:int = new int(114);
	 * var rgb:String = "0x"+ r.toString(16)+g.toString(16)+b.toString(16);
	 * trace(rgb); 
	 * // output: rgb:0xFA8072 (Hexadecimal equivalent of the color 'salmon')
	 * 
* * @helpid x2097E * @refpath Objects/Core/int/Methods/toString * @keyword number, number.tostring, tostring */ public native function toString(radix:uint):String; /** * Returns the primitive value of the specified int object. * * @playerversion Flash 9 * @langversion 3.0 * * @return An int value. * * @example The following example results in the primative value of the numSocks object. *
	 * var numSocks = new int(2);
	 * trace(numSocks.valueOf()); // output: 2
	 * 
* * @helpid x20A24 * @refpath Objects/Core/int/Methods/valueOf * @keyword number, number.valueof, valueof, value of */ public native function valueOf():int; } } package flash.errors { /** * The IOError exception is thrown when some type of input or output failure occurs. * For example, an IOError exception is thrown if a read/write operation is attempted on * a socket that has not connected or that has become disconnected. * * * @includeExample examples\IOErrorExample.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword Error */ public dynamic class IOError extends Error { /** * Creates a new IOError object. * * @param message A string associated with the error object. * * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword **/ function IOError(message:String = "") { super(message); } } } package { //**************************************************************************** // ActionScript Standard Library // Math object //**************************************************************************** /** * The Math class contains methods and constants that represent common mathematical * functions and values. *

Use the methods and properties of this class to access and manipulate mathematical constants and functions. * All the properties and methods of the Math class are static and must be called using the syntax * Math.method(parameter) or Math.constant. * In ActionScript, constants are defined with the maximum precision of double-precision IEEE-754 floating-point numbers.

*

Several Math class methods use the measure of an angle in radians as a parameter. You can use the following equation * to calculate radian values before calling the method and then provide the calculated value as the parameter, or you can * provide the entire right side of the equation (with the angle's measure in degrees in place of degrees) as * the radian parameter.

*

To calculate a radian value, use the following formula:

*
 * radians = degrees ~~ Math.PI/180
 * 
*

To calculate degrees from radians, use the following formula:

*
 * degrees = radians ~~ 180/Math.PI
 * 
*

The following is an example of passing the equation as a parameter to calculate the sine of a 45° angle:

*

Math.sin(45 ~~ Math.PI/180) is the same as Math.sin(.7854)

*

Note: The Math functions acos, asin, atan, atan2, cos, exp, log, pow, sin, and sqrt may * result in slightly different values depending on the algorithms * used by the CPU or operating system. Flash Player calls on the CPU (or operating system if the CPU doesn't support * floating point calculations) when performing the calculations for the listed functions, and results have shown * slight variations depending upon the CPU or operating system in use. *

* * * @playerversion Flash 9 * @langversion 3.0 * * @tiptext The Math class is a top-level class consisting of static properties and * methods that define common mathematical constants and functions. * * @helpid * @refpath * @keyword math, math object, built-in class */ public final class Math { /** * A mathematical constant for the base of natural logarithms, expressed as e. * The approximate value of e is 2.71828182845905. * * @playerversion Flash 9 * @langversion 3.0 * * @tiptext A mathematical constant for the base of natural logarithms, expressed as e. * * @oldexample This example shows how Math.E is used to compute * continuously compounded interest for a simple case of 100 percent interest over * a one-year period. *
  * var principal:Number = 100;
  * var simpleInterest:Number = 100;
  * var continuouslyCompoundedInterest:Number = (100 * Math.E) - principal;
  *
  * trace ("Beginning principal: $" + principal);
  * trace ("Simple interest after one year: $" + simpleInterest);
  * trace ("Continuously compounded interest after one year: $" + continuouslyCompoundedInterest);
  * 
  * // Output:
  * Beginning principal: $100
  * Simple interest after one year: $100
  * Continuously compounded interest after one year: $171.828182845905
  * 
* * @helpid * @refpath * @keyword math.e, e */ public static const E:Number = 2.71828182845905; /** * A mathematical constant for the natural logarithm of 10, expressed as loge10, * with an approximate value of 2.302585092994046. * * @playerversion Flash 9 * @langversion 3.0 * * @tiptext A mathematical constant for the natural logarithm of 10, expressed * as loge10, with an approximate value of 2.302585092994046. * * @helpid * @refpath * @keyword math.ln10, ln10, logarithm */ public static const LN10:Number = 2.302585092994046; /** * A mathematical constant for the natural logarithm of 2, expressed as loge2, * with an approximate value of 0.6931471805599453. * * @playerversion Flash 9 * @langversion 3.0 * * @tiptext A mathematical constant for the natural logarithm of 2, expressed * as loge2, with an approximate value of 0.6931471805599453. * * @helpid * @refpath * @keyword math.ln2, ln2, natural logarithm */ public static const LN2:Number = 0.6931471805599453; /** * A mathematical constant for the base-10 logarithm of the constant e (Math.E), * expressed as log10e, with an approximate value of 0.4342944819032518. *

The Math.log() method computes the natural logarithm of a number. Multiply the * result of Math.log() by Math.LOG10E obtain the base-10 logarithm.

* * @playerversion Flash 9 * @langversion 3.0 * * @tiptext A mathematical constant for the base-10 logarithm of the constant * e, expressed as log10e, with an approximate value of 0.4342944819032518. * * @oldexample This example shows how to obtain the base-10 logarithm of a number: *
  * trace(Math.log(1000) * Math.LOG10E);
* // Output: 3
*
* * @helpid * @refpath * @keyword math.log10e, log10e, logarithm */ public static const LOG10E:Number = 0.4342944819032518; /** * A mathematical constant for the base-2 logarithm of the constant e, expressed * as log2e, with an approximate value of 1.442695040888963387. * *

The Math.log method computes the natural logarithm of a number. Multiply the * result of Math.log() by Math.LOG2E obtain the base-2 logarithm.

* * @playerversion Flash 9 * @langversion 3.0 * * @tiptext A mathematical constant for the base-2 logarithm of the constant * e, expressed as log2e, with an approximate value of 1.442695040888963387. * * @oldexample This example shows how to obtain the base-2 logarithm of a number: *
  * trace(Math.log(16) * Math.LOG2E);
* // Output: 4
*
* * @helpid * @refpath * @keyword math.log2e, log2e, logarithm */ public static const LOG2E:Number = 1.442695040888963387; /** * A mathematical constant for the ratio of the circumference of a circle to its diameter, * expressed as pi, with a value of 3.141592653589793. * * @playerversion Flash 9 * @langversion 3.0 * * @tiptext A mathematical constant for the ratio of the circumference of a * circle to its diameter, expressed as pi, with a value of 3.141592653589793. * * @oldexample The following example draws a circle using the mathematical constant pi * and the Drawing API. *
  * drawCircle(this, 100, 100, 50);
  * 
  * function drawCircle(mc:MovieClip, x:Number, y:Number, r:Number):void {
  *   mc.lineStyle(2, 0xFF0000, 100);
  *   mc.moveTo(x + r, y);
  *   mc.curveTo(r + x, Math.tan(Math.PI/8) * r + y, Math.sin(Math.PI / 4) * r + x, Math.sin(Math.PI/4)*r+y);
  *   mc.curveTo(Math.tan(Math.PI/8)*r+x, r+y, x, r+y);
  *   mc.curveTo(-Math.tan(Math.PI/8)*r+x, r+y, -Math.sin(Math.PI/4)*r+x, Math.sin(Math.PI/4)*r+y);
  *   mc.curveTo(-r+x, Math.tan(Math.PI/8)*r+y, -r+x, y);
  *   mc.curveTo(-r+x, -Math.tan(Math.PI/8)*r+y, -Math.sin(Math.PI/4)*r+x, -Math.sin(Math.PI/4)*r+y);
  *   mc.curveTo(-Math.tan(Math.PI/8)*r+x, -r+y, x, -r+y);
  *   mc.curveTo(Math.tan(Math.PI/8)*r+x, -r+y, Math.sin(Math.PI/4)*r+x, -Math.sin(Math.PI/4)*r+y);
  *   mc.curveTo(r+x, -Math.tan(Math.PI/8)*r+y, r+x, y);
  * }
  * 
* * @helpid * @refpath * @keyword math.pi, pi */ public static const PI:Number = 3.141592653589793; /** * A mathematical constant for the square root of one-half, with an approximate * value of 0.7071067811865476. * * @playerversion Flash 9 * @langversion 3.0 * * @tiptext A mathematical constant for the square root of one-half, with an * approximate value of 0.7071067811865476. * * @helpid * @refpath * @keyword math.sqrt1_2, sqrt1_2, square root */ public static const SQRT1_2:Number = 0.7071067811865476; /** * A mathematical constant for the square root of 2, with an approximate * value of 1.4142135623730951. * * @playerversion Flash 9 * @langversion 3.0 * * @tiptext A mathematical constant for the square root of 2, with an * approximate value of 1.4142135623730951. * * @helpid * @refpath * @keyword math.sqrt2, sqrt2, square root */ public static const SQRT2:Number = 1.4142135623730951; /** * Computes and returns an absolute value for the number specified by the * parameter val. * * @playerversion Flash 9 * @langversion 3.0 * * @tiptext Returns the absolute value of the specified Number. * * @param val The Number whose absolute value is returned. * @return The absolute value of the specified paramater. * * @oldexample The following example shows how Math.abs() returns * the absolute value of a number and does not affect the value of the * val * parameter (called num in this example): *
  * var num:Number = -12;
  * var numAbsolute:Number = Math.abs(num);
  * trace(num); // Output: -12
  * trace(numAbsolute); // Output: 12
  * 
* * @helpid * @refpath * @keyword math.abs, abs, absolute */ public native static function abs(val:Number):Number; /** * Computes and returns the arc cosine of the number specified in the * parameter val, in radians. * * @playerversion Flash 9 * @langversion 3.0 * * @tiptext Returns the arc cosine, in radians, of the specified * Number. * * @param val A number from -1.0 to 1.0. * * @return The arc cosine of the parameter val. * * @oldexample The following example displays the arc cosine for several values. *
  * trace(Math.acos(-1)); // output: 3.14159265358979
  * trace(Math.acos(0));  // output: 1.5707963267949
  * trace(Math.acos(1));  // output: 0
  * 
* * @helpid * @refpath * @keyword math.acos, acos, arc cosine */ public native static function acos(val:Number):Number; /** * Computes and returns the arc sine for the number specified in the * parameter val, in radians. * * @playerversion Flash 9 * @langversion 3.0 * * @tiptext Returns the value, in radians, of the arc sine of the specified * Number parameter. * * @param val A Number from -1.0 to 1.0. * * @return A Number between negative pi divided by 2 and positive pi * divided by 2. * * @oldexample The following example displays the arc sine for several values. *
  * trace(Math.asin(-1)); // output: -1.5707963267949
  * trace(Math.asin(0));  // output: 0
  * trace(Math.asin(1));  // output: 1.5707963267949
  * 
* * @helpid * @refpath * @keyword math.asin, asin, arc sine */ public native static function asin(val:Number):Number; /** * Computes and returns the value, in radians, of the angle whose tangent is * specified in the parameter val. The return value is between * negative pi divided by 2 and positive pi divided by 2. * * @playerversion Flash 9 * @langversion 3.0 * * @tiptext Returns the angle, in radians, whose tangent is specified by * parameter val. * * @param val A Number that represents the tangent of an angle. * * @return A Number between negative pi divided by 2 and positive * pi divided by 2. * * @oldexample The following example displays the angle value for several tangents. *
  * trace(Math.atan(-1)); // output: -0.785398163397448
  * trace(Math.atan(0));  // output: 0
  * trace(Math.atan(1));  // output: 0.785398163397448
  * 
* * @helpid * @refpath * @keyword math.atan, atan, arc tangent */ public native static function atan(val:Number):Number; /** * Computes and returns the angle of the point y/x in * radians, when measured counterclockwise from a circle's x axis * (where 0,0 represents the center of the circle). The return value is between * positive pi and negative pi. Note that the first parameter to atan2 is always the y coordinate. * * @playerversion Flash 9 * @langversion 3.0 * * @tiptext Returns the angle of the point y/x in radians, when measured * counterclockwise from a circle's x axis. * * @param y The y coordinate of the point. * @param x The xcoordinate of the point. * * @return A number. * * @see Math#acos() * @see Math#asin() * @see Math#atan() * @see Math#cos() * @see Math#sin() * @see Math#tan() * * @oldexample The following example returns the angle, in radians, of the point specified by the coordinates (0, 10), such that x = 0 and y = 10. Note that the first parameter to atan2 is always the y coordinate. *
  * trace(Math.atan2(10, 0)); // output: 1.5707963267949
  * 
* * @helpid * @refpath * @keyword math.atan2, atan2, arc tangent */ public native static function atan2(y:Number,x:Number):Number; /** * Returns the ceiling of the specified number or expression. The ceiling of a * number is the closest integer that is greater than or equal to the number. * * @playerversion Flash 9 * @langversion 3.0 * * @tiptext Returns the ceiling of the specified number or expression. * * @param val A number or expression. * @return An integer that is both closest to, and greater than or equal to, parameter * val. * * @see Math#floor() * @see Math#round() * * @oldexample The following code returns a value of 13: *
  * Math.ceil(12.5);
  * 
* * @helpid * @refpath * @keyword math.ceil, ceil, ceiling */ public native static function ceil(val:Number):Number; /** * Computes and returns the cosine of the specified angle in radians. To * calculate a radian, see the overview of the Math class. * * * @playerversion Flash 9 * @langversion 3.0 * * @tiptext Returns the cosine of the specified angle. * * @param angleRadians A number that represents an angle measured in radians. * @return A number from -1.0 to 1.0. * * @oldexample The following example displays the cosine for several different angles. *
  * trace (Math.cos(0));         // 0 degree angle. Output: 1
  * trace (Math.cos(Math.PI/2)); // 90 degree angle. Output: 6.12303176911189e-17
  * trace (Math.cos(Math.PI));   // 180 degree angle. Output: -1
  * trace (Math.cos(Math.PI*2)); // 360 degree angle. Output: 1
  * 
*

Note: The cosine of a 90 degree angle is zero, but because of the inherent inaccuracy of decimal * calculations using binary numbers, Flash Player will report a number extremely close to, but not exactly equal to, zero.

* * @see Math#acos() * @see Math#asin() * @see Math#atan() * @see Math#atan2() * @see Math#sin() * @see Math#tan() * * @helpid * @refpath * @keyword math.cos, cos, cosine */ public native static function cos(angleRadians:Number):Number; /** * Returns the value of the base of the natural logarithm (e), to the * power of the exponent specified in the parameter x. The * constant Math.E can provide the value of e. * * @playerversion Flash 9 * @langversion 3.0 * * @tiptext Returns the value of the base of the natural logarithm * (e), to the power of the exponent specified in the parameter val. * * @param val The exponent; a number or expression. * @return e to the power of parameter val. * * @see Math#E * @helpid * @refpath * @keyword math.exp, exp, exponent */ public native static function exp(val:Number):Number; /** * Returns the floor of the number or expression specified in the parameter * val. The floor is the closest integer that is less than or equal * to the specified number or expression. * * @playerversion Flash 9 * @langversion 3.0 * * @tiptext Returns the floor of the number or expression specified in the * parameter val. * * @param val A number or expression. * @return The integer that is both closest to, and less than or equal to, parameter * val. * * @oldexample The following code returns a value of 12: *
  * Math.floor(12.5);
  * 
  * The following code returns a value of -7:
  * Math.floor(-6.5);
  * 
* * @helpid * @refpath * @keyword math.floor, floor */ public native static function floor(val:Number):Number; /** * Returns the natural logarithm of parameter val. * * @playerversion Flash 9 * @langversion 3.0 * * @tiptext Returns the natural logarithm of parameter val. * * @param val A number or expression with a value greater than 0. * @return The natural logarithm of parameter val. * * @oldexample The following example displays the logarithm for three numerical values. *
  * trace(Math.log(0)); // output: -Infinity
  * trace(Math.log(1)); // output: 0
  * trace(Math.log(2)); // output: 0.693147180559945
  * trace(Math.log(Math.E)); // output: 1
  * 
* * * @helpid * @refpath * @keyword math.log, log, logarithm */ public native static function log(val:Number):Number; /** * Evaluates val1 and val2 (or more values) and returns the largest value. * * @playerversion Flash 9 * @langversion 3.0 * * @tiptext Evaluates parameters val1 and val2 and * returns the larger value. * * @param val1 A number or expression. * @param val2 A number or expression. * @param ... A number or expression. Math.max() can accept multiple arguments. * @return The largest of the parameters val1 and val2 (or more values). * * @oldexample The following example displays Thu Dec 30 00:00:00 GMT-0700 2004, which is the larger of the evaluated expressions. *
  * var date1:Date = new Date(2004, 11, 25);
  * var date2:Date = new Date(2004, 11, 30);
  * var maxDate:Number = Math.max(date1.getTime(), date2.getTime());
  * trace(new Date(maxDate).toString());
  * 
* * @see Math#min() * * @helpid * @refpath * @keyword math.max, max, maximum */ public native static function max(val1:Number,val2:Number, ...rest):Number; /** * Evaluates val1 and val2 (or more values) and returns the smallest value. * * @playerversion Flash 9 * @langversion 3.0 * * @tiptext Evaluates parameters val1 and val2 and returns the smaller value. * * @param val1 A number or expression. * @param val2 A number or expression. * @param ... A number or expression. Math.min() can accept multiple arguments. * @return The smallest of the parameters val1 and val2 (or more values). * * @oldexample The following example displays Sat Dec 25 00:00:00 GMT-0700 2004, which is the smaller of the evaluated expressions. *
  * var date1:Date = new Date(2004, 11, 25);
  * var date2:Date = new Date(2004, 11, 30);
  * var minDate:Number = Math.min(date1.getTime(), date2.getTime());
  * trace(new Date(minDate).toString());
  * 
* * @see Math#max() * * @helpid * @refpath * @keyword math.min, min, minimum */ public native static function min(val1:Number,val2:Number, ... rest):Number; /** * Computes and returns val1 to the power of val2. * * @playerversion Flash 9 * @langversion 3.0 * * @tiptext Returns val1 to the power of val2. * * @param val1 A number to be raised by the power of parameter val2. * @param val2 A number specifying the power the parameter val2 is raised by. * @return The value of parameter val1 raised to the power of parameter * val2. * * @oldexample The following example uses Math.pow and Math.sqrt to calculate the length of a line. *
  * 	this.createEmptyMovieClip("canvas_mc", this.getNextHighestDepth());
  * 	var mouseListener:Object = new Object();
  * 	mouseListener.onMouseDown = function() {
  *   	this.origX = _xmouse;
  *   	this.origY = _ymouse;
  * };
  * mouseListener.onMouseUp = function() {
  *	this.newX = _xmouse;
  *	this.newY = _ymouse;
  *   var minY = Math.min(this.origY, this.newY);
  *   var nextDepth:Number = canvas_mc.getNextHighestDepth();
  *   var line_mc:MovieClip = canvas_mc.createEmptyMovieClip("line"+nextDepth+"_mc", nextDepth);
  *   line_mc.moveTo(this.origX, this.origY);
  *   line_mc.lineStyle(2, 0x000000, 100);
  *   line_mc.lineTo(this.newX, this.newY);
  *   var hypLen:Number = Math.sqrt(Math.pow(line_mc._width, 2)+Math.pow(line_mc._height, 2));
  *   line_mc.createTextField("length"+nextDepth+"_txt", canvas_mc.getNextHighestDepth(), this.origX, this.origY-22, 100, 22);
  *   line_mc["length"+nextDepth+"_txt"].text = Math.round(hypLen) +" pixels";
  * };
  * Mouse.addListener(mouseListener);
  * 
* * * @helpid * @refpath * @keyword math.pow, pow, power */ public native static function pow(val1:Number,val2:Number):Number; /** * Returns a pseudo-random number n, where 0 <= n < 1. The number returned is calculated in an undisclosed manner, and "pseudo-random" because the calculation inevitably contains some element of "non-randomness". * * @playerversion Flash 9 * @langversion 3.0 * * @tiptext Returns a pseudo-random number n, where 0 <= n < 1. * * @return A pseudo-random number. * * @oldexample The following example outputs 100 random integers between 4 and 11 * (inclusively): *
  * function randRange(min:Number, max:Number):Number {
  *    var randomNum:Number = Math.floor(Math.random() * (max - min + 1)) + min;
  *    return randomNum;
  * }
  * for (var i = 0; i < 100; i++) {
  *    var n:Number = randRange(4, 11)
  *    trace(n);
  * }
  * 
* * * @helpid * @refpath * @keyword math.random, random */ public native static function random():Number; /** * Rounds the value of the parameter val up or down to the nearest * integer and returns the value. If parameter val is equidistant * from its two nearest integers (that is, the number ends in .5), the value * is rounded up to the next higher integer. * * @playerversion Flash 9 * @langversion 3.0 * * @tiptext Returns the value of parameter val rounded up or down to the * nearest integer. * * @param val The number to round. * @return Parameter val rounded to the nearest whole number. * * @oldexample The following example returns a random number between two specified integers. *
  * function randRange(min:Number, max:Number):Number {
  *   var randomNum:Number = Math.round(Math.random() * (max - min + 1) + (min - .5));
  *   return randomNum;
  * }
  * for (var i = 0; i<25; i++) {
  *   trace(randRange(4, 11));
  * }
  * 
* * @see Math#ceil() * @see Math#floor() * * @helpid * @refpath * @keyword math.round, round */ public native static function round(val:Number):Number; /** * Computes and returns the sine of the specified angle in radians. To * calculate a radian, see the overview of the Math class. * * * @playerversion Flash 9 * @langversion 3.0 * * @tiptext Returns the sine of the specified angle. * * @param angleRadians A number that represents an angle measured in radians. * @return A number; the sine of the specified angle (between -1.0 and 1.0). * * @oldexample The following example draws a circle using the mathematical constant pi, the sine of an angle, and the Drawing API. *
  * drawCircle(this, 100, 100, 50);
  * //
  * function drawCircle(mc:MovieClip, x:Number, y:Number, r:Number):void {
  *   mc.lineStyle(2, 0xFF0000, 100);
  *   mc.moveTo(x+r, y);
  *   mc.curveTo(r+x, Math.tan(Math.PI/8)~r+y, Math.sin(Math.PI/4)~r+x, Math.sin(Math.PI/4)~r+y);
  *   mc.curveTo(Math.tan(Math.PI/8)~r+x, r+y, x, r+y);
  *   mc.curveTo(-Math.tan(Math.PI/8)~r+x, r+y, -Math.sin(Math.PI/4)~r+x, Math.sin(Math.PI/4)~r+y);
  *   mc.curveTo(-r+x, Math.tan(Math.PI/8)~r+y, -r+x, y);
  *   mc.curveTo(-r+x, -Math.tan(Math.PI/8)~r+y, -Math.sin(Math.PI/4)~r+x, -Math.sin(Math.PI/4)~r+y);
  *   mc.curveTo(-Math.tan(Math.PI/8)~r+x, -r+y, x, -r+y);
  *   mc.curveTo(Math.tan(Math.PI/8)~r+x, -r+y, Math.sin(Math.PI/4)~r+x, -Math.sin(Math.PI/4)~r+y);
  *   mc.curveTo(r+x, -Math.tan(Math.PI/8)~r+y, r+x, y);
  * }
  * 
* * @see Math#acos() * @see Math#asin() * @see Math#atan() * @see Math#atan2() * @see Math#cos() * @see Math#tan() * * @helpid * @refpath * @keyword math.sin, sin, sine */ public native static function sin(angleRadians:Number):Number; /** * Computes and returns the square root of the specified number. * * @playerversion Flash 9 * @langversion 3.0 * * @tiptext Returns the square root of the specified number. * * @param val A number or expression greater than or equal to 0. * @return A number if parameter val is greater than or equal to zero; NaN (not a number) otherwise. * * @oldexample The following example uses Math.pow and Math.sqrt to calculate the length of a line. *
  * this.createEmptyMovieClip("canvas_mc", this.getNextHighestDepth());
  * var mouseListener:Object = new Object();
  * mouseListener.onMouseDown = function() {
  *   this.origX = _xmouse;
  *   this.origY = _ymouse;
  * };
  * mouseListener.onMouseUp = function() {
  *   this.newX = _xmouse;
  *   this.newY = _ymouse;
  *   var minY = Math.min(this.origY, this.newY);
  *   var nextDepth:Number = canvas_mc.getNextHighestDepth();
  *   var line_mc:MovieClip = canvas_mc.createEmptyMovieClip("line"+nextDepth+"_mc", nextDepth);
  *   line_mc.moveTo(this.origX, this.origY);
  *   line_mc.lineStyle(2, 0x000000, 100);
  *   line_mc.lineTo(this.newX, this.newY);
  *   var hypLen:Number = Math.sqrt(Math.pow(line_mc._width, 2)+Math.pow(line_mc._height, 2));
  *   line_mc.createTextField("length"+nextDepth+"_txt", canvas_mc.getNextHighestDepth(), this.origX, this.origY-22, 100, 22);
  *   line_mc['length'+nextDepth+'_txt'].text = Math.round(hypLen) +" pixels";
  * };
  * Mouse.addListener(mouseListener);
  * 
* * * @helpid * @refpath * @keyword math.sqrt, sqrt, square root */ public native static function sqrt(val:Number):Number; /** * Computes and returns the tangent of the specified angle. To calculate a * radian, see the overview of the Math class. * * * @playerversion Flash 9 * @langversion 3.0 * * @tiptext Returns the tangent of the specified angle. * * @param angleRadians A number that represents an angle measured in radians. * @return The tangent of parameter angleRadians. * * @oldexample The following example draws a circle using the mathematical constant pi, the tangent of an angle, and the Drawing API. *
  * drawCircle(this, 100, 100, 50);
  * //
  * function drawCircle(mc:MovieClip, x:Number, y:Number, r:Number):void {
  *   mc.lineStyle(2, 0xFF0000, 100);
  *   mc.moveTo(x+r, y);
  *   mc.curveTo(r+x, Math.tan(Math.PI/8)~r+y, Math.sin(Math.PI/4)~r+x, Math.sin(Math.PI/4)~r+y);
  *   mc.curveTo(Math.tan(Math.PI/8)~r+x, r+y, x, r+y);
  *   mc.curveTo(-Math.tan(Math.PI/8)~r+x, r+y, -Math.sin(Math.PI/4)~r+x, Math.sin(Math.PI/4)~r+y);
  *   mc.curveTo(-r+x, Math.tan(Math.PI/8)~r+y, -r+x, y);
  *   mc.curveTo(-r+x, -Math.tan(Math.PI/8)~r+y, -Math.sin(Math.PI/4)~r+x, -Math.sin(Math.PI/4)~r+y);
  *   mc.curveTo(-Math.tan(Math.PI/8)~r+x, -r+y, x, -r+y);
  *   mc.curveTo(Math.tan(Math.PI/8)~r+x, -r+y, Math.sin(Math.PI/4)~r+x, -Math.sin(Math.PI/4)~r+y);
  *   mc.curveTo(r+x, -Math.tan(Math.PI/8)~r+y, r+x, y);
  * }
  * 
* * @see Math#acos() * @see Math#asin() * @see Math#atan() * @see Math#atan2() * @see Math#cos() * @see Math#sin() * * @helpid * @refpath * @keyword math.tan, tan, tangent */ public native static function tan(angleRadians:Number):Number; } } package flash.errors { /** * The MemoryError exception is thrown when a memory allocation request fails. * *

On a desktop machine, memory allocation failures are rare unless an allocation * request is extremely large; a 32-bit Windows program can access only 2GB of * address space, for example, so a request for 10 billion bytes is impossible.

* *

By default, Flash Player does not impose a limit on how much memory an * ActionScript program may allocate.

* * @includeExample examples\MemoryErrorExample.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword Error */ public dynamic class MemoryError extends Error { /** * Creates a new MemoryError object. * * @param message A string associated with the error object. * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword **/ function MemoryError(message:String = "") { super(message); } } } package { // // Namespace // // Based on the ECMA E4X spec, 1st Edition /** * * The Namespace class contains methods and properties for defining and working with namespaces. * There are three use cases for using namespaces: * * * *

This class (along with the XML, XMLList, and QName classes) implements * powerful XML-handling standards defined in ECMAScript for XML * (E4X) specification (ECMA-357 edition 2).

* * @includeExample examples\NamespaceExample.1.as -noswf * @includeExample examples\NamespaceExample.2.as -noswf * * @tiptext The Namespace class contains methods and properties for defining and * working with namespaces of XML objects. * * @see XML * @see XMLList * @see QName * @see http://www.ecma-international.org/publications/standards/Ecma-357.htm ECMAScript for XML * (E4X) specification (ECMA-357 edition 2) * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword Namespace */ public final class Namespace { /** * Creates a Namespace object given the uriValue parameter. * The values assigned to the uri and prefix properties * of the new Namespace object depend on the type of value passed for the uriValue parameter: * *

Note: This class shows two constructor method entries because the constructor accepts * variable types of arguments. The constructor behaves differently depending on the type and number of * arguments passed, as detailed in each entry. ActionSript 3.0 does not support method or constructor overloading.

* * @tiptext Creates a Namespace object, given the uriValue. * * @param uriValue The Uniform Resource Identifier (URI) of the namespace. * * * @playerversion Flash 9 * @langversion 3.0 * @helpid **/ public native function Namespace(uriValue:*); /** * The default number of arguments for the constructor. You can specify prefix or uri or both arguments. For details, see the Namespace() constructor function. * @playerversion Flash 9 * @langversion 3.0 * @see #Namespace() */ public static const length:int = 2; /** * Creates a Namespace object, given the prefixValue and uriValue parameters. * This constructor requires both parameters. *

The value of the prefixValue parameter is assigned to the prefix * property in the following manner:

* * *

The value of the uriValue parameter is assigned to the uri * property in the following manner:

* *

Note: This class shows two constructor method entries because the constructor accepts * variable types of arguments. The constructor behaves differently depending on the type and number of * arguments passed, as detailed in each entry. ActionSript 3.0 does not support method or constructor overloading.

* * @tiptext Creates a Namespace object, given the prefixValue and uriValue. * * @param prefixValue The prefix to use for the namespace. * * @param uriValue The Uniform Resource Identifier (URI) of the namespace. * * * @playerversion Flash 9 * @langversion 3.0 * @helpid **/ public native function Namespace(prefixValue:*, uriValue:*); /** * Equivalent to the Namespace.uri property. * * @tiptext Equivalent to the Namespace.uri property. * * @return The Uniform Resource Identifier (URI) of the namespace, as a string. * * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword Namespace, Namespace.toString, toString **/ public native function toString():String; /** * The prefix of the namespace. * * @tiptext The prefix of the namespace. * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword Namespace, Namespace.prefix, prefix **/ public native function get prefix():String; public native function set prefix(value:String):void; /** * The Uniform Resource Identifier (URI) of the namespace. * * @tiptext The Uniform Resource Identifier (URI) of the namespace. * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword Namespace, Namespace.uri, uri **/ public native function get uri():String; public native function set uri(value:String):void; } } package { //**************************************************************************** // ActionScript Standard Library // Number object //**************************************************************************** /** * A data type representing an IEEE-754 double-precision floating-point number. You can manipulate primitive numeric * values by using the methods and properties associated with the Number class. This class is identical to the * JavaScript Number class. *

The properties of the Number class are static, which means you do not need an object to use them, so you * do not need to use the constructor.

*

The Number data type adheres to the double-precision IEEE-754 standard.

*

The Number data type is useful when you need to use floating-point values. * Flash Player handles int and uint more efficiently than Number, but Number is * useful in situations where the range of values required exceeds the valid range * of the int and uint data types. The Number class can be used to * represent integer values well beyond the valid range of the int and uint data types. * The Number data type can use up to 53 bits to represent integer values, compared to * the 32 bits available to int and uint. The default value of a variable typed as Number is NaN (Not a Number).

* * @includeExample examples\NumberExample.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * * @tiptext The Number class is a simple wrapper object for the Number * data type. * * @see int.html int * @see uint.html uint * @helpid * @refpath * @keyword number object, number, built-in class */ public final class Number { /** * The default number of arguments for the constructor. You can specify 1 or no arguments. For details, see the Number() constructor function. * @playerversion Flash 9 * @langversion 3.0 * @see #Number() */ public static const length:int = 1; /** * The largest representable number (double-precision IEEE-754). This number is * approximately 1.79e+308. * * @playerversion Flash 9 * @langversion 3.0 * * @tiptext The largest representable number (double-precision IEEE-754). * * @oldexample The following ActionScript displayswrites the largest and smallest representable numbers to the Output panelto the log file. *
  * trace("Number.MIN_VALUE = "+Number.MIN_VALUE);
  * trace("Number.MAX_VALUE = "+Number.MAX_VALUE);
  * 
*

This code logsdisplays the following values:

*
  * Number.MIN_VALUE = 4.94065645841247e-324
  * Number.MAX_VALUE = 1.79769313486232e+308
  * 
* * * @helpid * @refpath * @keyword number, number.max_value, max_value, max value */ public static const MAX_VALUE:Number; /** * The smallest representable non-negative, non-zero, number (double-precision IEEE-754). This number is * approximately 5e-324. The smallest representable number overall is actually -Number.MAX_VALUE. * * @playerversion Flash 9 * @langversion 3.0 * * @tiptext The smallest representable number (double-precision IEEE-754). * * @oldexample The following ActionScript displayswrites the largest and smallest representable numbers to the Output panel to the log file. *
  * trace("Number.MIN_VALUE = "+Number.MIN_VALUE);
  * trace("Number.MAX_VALUE = "+Number.MAX_VALUE);
  * 
*

This code logsdisplays the following values:

*
  * Number.MIN_VALUE = 4.94065645841247e-324
  * Number.MAX_VALUE = 1.79769313486232e+308
  * 
* * * @helpid * @refpath * @keyword number, number.min_value, min_value, min value */ public static const MIN_VALUE:Number; /** * The IEEE-754 value representing Not a Number (NaN). * * @playerversion Flash 9 * @langversion 3.0 * * @tiptext The IEEE-754 value representing Not a Number (NaN). * * @see package.html#isNaN() isNaN() * @helpid * @refpath * @keyword number, number.nan, nan, not a number */ public static const NaN:Number; /** * Specifies the IEEE-754 value representing negative infinity. The value of this property * is the same as that of the constant -Infinity. *

* Negative infinity is a special numeric value that is returned when a mathematical * operation or function returns a negative value larger than can be * represented. *

* * @playerversion Flash 9 * @langversion 3.0 * * @tiptext Specifies the IEEE-754 value representing negative infinity. * * @oldexample This example compares the result of dividing the following values. *
  * var posResult:Number = 1/0;
  * if (posResult == Number.POSITIVE_INFINITY) {
  *   trace("posResult = "+posResult); // output: posResult = Infinity
  * }
  * var negResult:Number = -1/0;
  * if (negResult == Number.NEGATIVE_INFINITY) {
  *   trace("negResult = "+negResult); // output: negResult = -Infinity
  * 
* * * @helpid * @refpath * @keyword number, number.negative_infinity, negative_infinity, negative infinity, infinity */ public static const NEGATIVE_INFINITY:Number; /** * Specifies the IEEE-754 value representing positive infinity. The value of this property * is the same as that of the constant Infinity. *

* Positive infinity is a special numeric value that is returned when a mathematical * operation or function returns a value larger than can be represented. *

* * @playerversion Flash 9 * @langversion 3.0 * * @tiptext Specifies the IEEE-754 value representing positive infinity. * * @oldexample This example compares the result of dividing the following values. *
  * var posResult:Number = 1/0;
  * if (posResult == Number.POSITIVE_INFINITY) {
  *   trace("posResult = "+posResult); // output: posResult = Infinity
  * }
  * var negResult:Number = -1/0;
  * if (negResult == Number.NEGATIVE_INFINITY) {
  *   trace("negResult = "+negResult); // output: negResult = -Infinity
  * 
* * * @helpid * @refpath * @keyword number, number.positive_infinity, positive_infinity, positive infinity, infinity */ public static const POSITIVE_INFINITY:Number; /** * Creates a Number with the specified value. This constructor has the same effect * as the Number() public native function that converts an object of a different type * to a primitive numeric value. * * @playerversion Flash 9 * @langversion 3.0 * * @tiptext Creates a Number with the specified value. * * @param num The numeric value of the Number instance being created or a value * to be converted to a Number. The default value is 0 if num is * not specified. Using the constructor without specifying a num parameter is not * the same as declaring a variable of type Number with no value assigned (such as var myNumber:Number), which * defaults to NaN. A number with no value assigned is undefined and the equivalent of new Number(undefined). * * @oldexample The following code constructs new Number objects: *
  * var n1:Number = new Number(3.4);
  * var n2:Number = new Number(-10);
  * 
* * * @see #toString() Number.toString() * @see #valueOf() Number.valueOf() * @helpid * @refpath * @keyword new number, constructor */ public native function Number(num:Object); /** */ private static native function _convert(n:Number, precision:int, mode:int):String /** * Returns the string representation of the specified Number object (myNumber). * If the value of the Number object is a decimal number without a leading zero (such as .4), * Number.toString() adds a leading zero (0.4). * * * @playerversion Flash 9 * @langversion 3.0 * * @tiptext Returns the string representation of this Number using the specified * radix parameter as the numeric base. * * @param radix Specifies the numeric base (from 2 to 36) to use for the number-to-string * conversion. If you do not specify the radix parameter, the default value * is 10. * * @return The numeric representation of this Number as a string. * * @oldexample The following example uses 2 and 8 for the radix parameter and returns a string that contains the corresponding representation of the number 9: *
 * var myNumber:Number = new Number(9);
 * trace(myNumber.toString(2)); // output: 1001
 * trace(myNumber.toString(8)); // output: 11
 * 
* The following example results in a hexadecimal value. *
 * var r:Number = new Number(250);
 * var g:Number = new Number(128);
 * var b:Number = new Number(114);
 * var rgb:String = "0x"+ r.toString(16)+g.toString(16)+b.toString(16);
 * trace(rgb); 
 * // output: rgb:0xFA8072 (Hexadecimal equivalent of the color 'salmon')
 * 
* * @helpid * @refpath * @keyword number, number.tostring, tostring */ public native function toString(radix:Number = 10):String; /** * Returns the primitive value type of the specified Number object. * * @playerversion Flash 9 * @langversion 3.0 * * @tiptext Returns the primitive value type of the specified Number object. * * @return The primitive type value of this Number. * * @oldexample The following example results in the primative value of the numSocks object. *
 * var numSocks = new Number(2);
 * trace(numSocks.valueOf()); // output: 2
 * 
* * @helpid * @refpath * @keyword number, number.valueof, valueof, value of */ public native function valueOf():Number; /** * Returns a string representation of the number in fixed-point notation. * Fixed-point notation means that the string will contain a specific number of digits * after the decimal point, as specified in the fractionDigits parameter. * The valid range for the fractionDigits parameter is from 0 to 20. * Specifying a value outside this range throws an exception. * * @param fractionDigits An integer between 0 and 20, inclusive, that represents the desired number of decimal places. * @throws RangeError Throws an exception if the fractionDigits argument is outside the range 0 to 20. * @includeExample examples\Number.toFixed.1.as -noswf * @includeExample examples\Number.toFixed.2.as -noswf */ public native function toFixed(fractionDigits:uint):String; /** * Returns a string representation of the number in exponential notation. The string contains * one digit before the decimal point and up to 20 digits after the decimal point, as * specified by the fractionDigits parameter. * @param fractionDigits An integer between 0 and 20, inclusive, that represents the desired number of decimal places. * @throws RangeError Throws an exception if the fractionDigits argument is outside the range 0 to 20. * @includeExample examples\Number.toExponential.1.as -noswf */ public native function toExponential(fractionDigits:uint):String; /** * Returns a string representation of the number either in exponential notation or in * fixed-point notation. The string will contain the number of digits specified in the * precision parameter. * @param precision An integer between 1 and 21, inclusive, that represents the desired number of digits to represent in the resulting string. * @throws RangeError Throws an exception if the precision argument is outside the range 1 to 21. * @includeExample examples\Number.toPrecision.1.as -noswf * @includeExample examples\Number.toPrecision.2.as -noswf */ public native function toPrecision(precision:uint):String; } } package { //**************************************************************************** // ActionScript Standard Library // Object object //**************************************************************************** /** * The Object class is at the root of the ActionScript class hierarchy. Objects are created by constructors using the * new operator syntax, and can have properties assigned to them dynamically. Objects can also be created by * assigning an object literal, as in: * var obj:Object = {a:"foo", b:"bar"} * *

All classes that don't declare an explicit base class extend the built-in Object class.

*

You can use the Object class to create associative arrays. At its core, an associative array is an instance of the Object class, and each key-value pair is represented by a property and its value. Another reason to declare an associative array using the Object data type is that you can then use an object literal to populate your associative array (but only at the time you declare it). The following example creates an associative array using an object literal, accesses items using both the dot operator and the array access operator, and then adds a new key-value pair by creating a new property:

* * var myAssocArray:Object = {fname:"John", lname:"Public"}; * trace(myAssocArray.fname); // Output: John * trace(myAssocArray["lname"]); // Output: Public * myAssocArray.initial = "Q"; * trace(myAssocArray.initial); // Output: Q * *

ActionScript 3.0 has two types of inheritance: "class inheritance" and "prototype inheritance":

* *

Both class inheritance and prototype inheritance can exist simultaneously, such as:

* * class A { * var x = 1 * prototype.px = 2 * } * dynamic class B extends A { * var y = 3 * prototype.py = 4 * } * * var b = new B() * b.x // 1 via class inheritance * b.px // 2 via prototype inheritance from A.prototype * b.y // 3 * b.py // 4 via prototype inheritance from B.prototype * * B.prototype.px = 5 * b.px // now 5 because B.prototype hides A.prototype * * b.px = 6 * b.px // now 6 because b hides B.prototype * *

Using functions instead of classes, you can construct custom prototype inheritance trees. With classes, the prototype inheritance tree mirrors the class inheritance tree. However, since the prototype objects are dynamic, you can add and delete prototype-based properties at runtime.

* * @playerversion Flash 9 * * @includeExample examples\ObjectExample.as -noswf * * @helpid x20982 * @refpath Objects/Core/Object * @keyword object, object object, built-in class * * @see #prototype */ public dynamic class Object { /** * A reference to the prototype object of a class or function object. The prototype property * is automatically created and attached to any class or function object that you create. This property is * static in that it is specific to the class or function that you create. For example, if you create a * class, the value of the prototype property is shared by all instances of the class and is * accessible only as a class property. Instances of your class cannot directly access * the prototype property. *

A class's prototype object is a special instance of that class that provides a mechanism for sharing state across all instances of a class. At runtime, when a property is not found on a class instance, the delegate, which is the class prototype object, is checked for that property. If the prototype object does not contain the property, the process continues with the prototype object's delegate on up the hierarchy until Flash Player finds the property.

*

Note: In ActionScript 3.0, prototype inheritance is not the primary mechanism for inheritance. Class inheritance, which drives the inheritance of fixed properties in class definitions, is the primary inheritance mechanism. For more information on class inheritance. Need XREF to Prog AS3

* * @maelexample The following example creates a class named Shape and a subclass of Shape named Circle. * * // Shape class defined in external file named Shape.as * class Shape { * function Shape() {} * } * * // Circle class defined in external file named Circle.as * class Circle extends Shape{ * function Circle() {} * } * * The Circle class can be used to create two instances of Circle: * * var oneCircle:Circle = new Circle(); * var twoCircle:Circle = new Circle(); * * The following trace statement shows that the prototype property of the Circle class points to its superclass Shape. The identifier Shape refers to the constructor function of the Shape class. * * trace(Circle.prototype.constructor == Shape); // Output: true * * The following trace statement shows how you can use the prototype property and the __proto__ property together to move two levels up the inheritance hierarchy (or prototype chain). The Circle.prototype.__proto__ property contains a reference to the superclass of the Shape class. * * trace(Circle.prototype.__proto__ == Shape.prototype); // Output: true * * * * @playerversion Flash 9 * @langversion 3.0 */ public static var prototype:Object; /** * The default number of arguments for the constructor. You can specify 1 or no arguments. For details, see the Object() constructor function. * @playerversion Flash 9 * @langversion 3.0 * @see #Object() */ public static const length:int = 1; /** * A reference to the class object or constructor function for a given object instance. * If an object is an instance of a class, the constructor * property holds a reference to the class object. * If an object is created with a constructor function, the constructor * property holds a reference to the constructor function. * Do not confuse a constructor function with a constructor method of a class. * A constructor function is a Function object used to create objects, and is an * alternative to using the class keyword for defining classes. * *

If you use the class keyword to define a class, the class's prototype object * is assigned a property named constructor that holds a reference to the class object. * An instance of the class inherits this property from the prototype object. For example, * the following code creates a new class, A, and a class instance named myA:

* * dynamic class A {} * trace(A.prototype.constructor); // [class A] * trace(A.prototype.constructor == A); // true * var myA:A = new A(); * trace(myA.constructor == A); // true * *

Advanced users may choose to use the function keyword instead of the class * keyword to define a Function object that can be used as a template for the creation of objects. Such a * function is called a constructor function because you can use it in conjunction with the new * operator to create new objects. * If you use the function keyword to create a constructor function, its prototype object is assigned * a property named constructor that holds a reference to the constructor function. * If you then use the constructor function to create an new object, the object inherits the * constructor property from the constructor function's prototype object. For example, * the following code creates a new constructor function, f, and an object named myF:

* * function f() {} * trace(f.prototype.constructor); // function Function() {} * trace(f.prototype.constructor == f); // true * var myF = new f(); * trace(myF.constructor == f); // true * *

Note: The constructor property is writable, which means that user code can change * its value with an assignment statement. Changing the value of the constructor property is not * recommended, but if you write code that depends on the value of the constructor property, you should * ensure that the value is not reset. The value can be changed only when the property is accessed through the prototype * object (for example, className.prototype.constructor).

* @playerversion Flash 9 * * @see Class * @see Function * @see #prototype * @helpid * @refpath * @keyword Object, Object.constructor, constructor */ var constructor:Object; /** * Creates an Object object and stores a reference to the object's constructor method in the object's constructor property. * * @version Flash Player 8.0 * */ public native function Object(); /** * Indicates whether an object has a specified property defined. This method returns true if the target object has * a property that matches the string specified by the name parameter, and false otherwise. * The following types of properties cause this method to return true for objects that are instances of a class (as opposed to class objects): * *

The following types of properties cause this method to return false for objects that are instances of a class:

* * *

ActionScript 3.0 also has class objects, which are concrete representations of class definitions. * When called on class objects, hasOwnProperty() returns true only if a property * is a static property defined on that class object. For example, if you create a subclass of Array named * CustomArray, and define a static property in CustomArray named foo, a call to * CustomArray.hasOwnProperty("foo") returns true. * For the static property DESCENDING defined in the Array class, however, a call to * CustomArray.hasOwnProperty("DESCENDING") returns false.

* *

Note: Methods of the Object class are dynamically created on Object's prototype. To redefine this method in a subclass of Object, do not use the override keyword. For example, A subclass of Object implements function hasOwnProperty():Boolean instead of using an override of the base class.

* * @param name The property of the object. * @return If the target object has the property specified by the name * parameter this value is true, otherwise false. * * @category Method * @playerversion Flash 9 * @langversion 3.0 */ public native function hasOwnProperty(name:String):Boolean; /** * Indicates whether the specified property exists and is enumerable. If true, then the property exists and * can be enumerated in a for..in loop. The property must exist on the target object because this method does not * check the target object's prototype chain. * *

Properties that you create are enumerable, but built-in properties are generally not enumerable.

* *

Note: Methods of the Object class are dynamically created on Object's prototype. To redefine this method in a subclass of Object, do not use the override keyword. For example, A subclass of Object implements function propertyIsEnumerable():Boolean instead of using an override of the base class.

* * @param name The property of the object. * @return If the property specified by the name parameter is enumerable this value is true, otherwise false. * * @maelexample The following example creates a generic object, adds a property to the object, then checks whether the object is enumerable. By way of contrast, the example also shows that a built-in property, the Array.length property, is not enumerable. * * var myObj:Object = new Object(); * myObj.prop1 = "hello"; * trace(myObj.propertyIsEnumerable("prop1")); // Output: true * * var myArray = new Array(); * trace(myArray.propertyIsEnumerable("length")); // Output: false * * * @playerversion Flash 9 * @langversion 3.0 */ public native function propertyIsEnumerable(name:String):Boolean; /** * Indicates whether an instance of the Object class is in the prototype chain of the object specified * as the parameter. This method returns true if the object is in the prototype chain of the * object specified by the theClass parameter. The method returns false * if the target object is absent from the prototype chain of the theClass object, * and also if the theClass parameter is not an object. * *

Note: Methods of the Object class are dynamically created on Object's prototype. To redefine this method in a subclass of Object, do not use the override keyword. For example, A subclass of Object implements function isPrototypeOf():Boolean instead of using an override of the base class.

* * @param theClass The class to which the specified object may refer. * * @return If the object is in the prototype chain of the object * specified by the theClass parameter this value is true, otherwise false. * * @playerversion Flash 9 * @langversion 3.0 */ public native function isPrototypeOf(theClass:Object):Boolean; /** * Sets the availability of a dynamic property for loop operations. The property must exist on the target object because this method does not check the target object's prototype chain. * @param name The property of the object. * @param isEnum If set to false, the dynamic property will not show up in for..in loops, and the method propertyIsEnumerable() will return false. * @playerversion Flash 9 * @langversion 3.0 * @see #propertyIsEnumerable() */ public native function setPropertyIsEnumerable(name:String, isEnum:Boolean=true):void; /** * @playerversion Flash 9 * @langversion 3.0 * */ public native function toLocaleString():String; /** * Returns the string representation of the specified object. * *

Note: Methods of the Object class are dynamically created on Object's prototype. To redefine this method in a subclass of Object, do not use the override keyword. For example, A subclass of Object implements function toString():String instead of using an override of the base class.

* * @playerversion Flash 9 * * @return A string representation of the object. * * @oldexample This example shows the return value for toString() on a generic object: *
	 * var myObject:Object = new Object();
* trace(myObject.toString()); // output: [object Object]
*
*

This method can be overridden to return a more meaningful value. The following examples show that this method has been overridden for the built-in classes Date, Array, and Number:

*
	 * // Date.toString() returns the current date and time
* var myDate:Date = new Date();
* trace(myDate.toString()); // output: [current date and time]
*
* // Array.toString() returns the array contents as a comma-delimited string
* var myArray:Array = new Array("one", "two");
* trace(myArray.toString()); // output: one,two
*
* // Number.toString() returns the number value as a string
* // Because trace() won't tell us whether the value is a string or number
* // we will also use typeof() to test whether toString() works.
* var myNumber:Number = 5;
* trace(typeof (myNumber)); // output: number
* trace(myNumber.toString()); // output: 5
* trace(typeof (myNumber.toString())); // output: string
*
*

The following example shows how to override toString() in a class. First create a text file named Vehicle.as that contains only the Vehicle class definition and place it into your Classes folder inside your Configuration folder.

*
	 * // contents of Vehicle.as
* class Vehicle {
* var numDoors:Number;
* var color:String;
* function Vehicle(param_numDoors:Number, param_color:String) {
* this.numDoors = param_numDoors;
* this.color = param_color;
* }
* function toString():String {
* var doors:String = "door";
* if (this.numDoors > 1) {
* doors += "s";
* }
* return ("A vehicle that is " + this.color + " and has " + this.numDoors + " " + doors);
* }
* }
*
* // code to place into a FLA file
* var myVehicle:Vehicle = new Vehicle(2, "red");
* trace(myVehicle.toString());
* // output: A vehicle that is red and has 2 doors
*
* // for comparison purposes, this is a call to valueOf()
* // there is no primitive value of myVehicle, so the object is returned
* // giving the same output as toString().
* trace(myVehicle.valueOf());
* // output: A vehicle that is red and has 2 doors
*
*
* * @helpid x20983 * @refpath Objects/Core/Object/Methods/toString * @keyword object, object.tostring, tostring */ public native function toString():String; /** * Returns the primitive value of the specified object. If this object * does not have a primitive value, the object itself is returned. *

Note: Methods of the Object class are dynamically created on Object's prototype. To redefine this method in a subclass of Object, do not use the override keyword. For example, A subclass of Object implements function valueOf():Object instead of using an override of the base class.

* * @playerversion Flash 9 * * @return The primitive value of this object or the object itself. * * @oldexample The following example shows the return value of valueOf() for a generic object (which does not have a primitive value) and compares it to the return value of toString(): *
	 * // Create a generic object
* var myObject:Object = new Object();
* trace(myObject.valueOf()); // output: [object Object]
* trace(myObject.toString()); // output: [object Object]
*
*

The following examples show the return values for the built-in classes Date and Array, and compares them to the return values of Object.toString():

*
	 * // Create a new Date object set to February 1, 2004, 8:15 AM
* // The toString() method returns the current time in human-readable form
* // The valueOf() method returns the primitive value in milliseconds
* var myDate:Date = new Date(2004,01,01,8,15);
* trace(myDate.toString()); // output: Sun Feb 1 08:15:00 GMT-0800 2004
* trace(myDate.valueOf()); // output: 1075652100000
*
* // Create a new Array object containing two simple elements
* // In this case both toString() and valueOf() return the same value: one,two
* var myArray:Array = new Array("one", "two");
* trace(myArray.toString()); // output: one,two
* trace(myArray.valueOf()); // output: one,two
*
* *

See the example for Object.toString() for an example of the return value * of Object.valueOf() for a class that overrides toString().

* * @see Object#toString() * * @helpid x20984 * @refpath Objects/Core/Object/Methods/valueOf * @keyword object, object.valueof, valueof */ public native function valueOf():Object; } } package { // // QName // // Based on the ECMA E4X spec, 1st Edition /** * * QName objects represent qualified names of XML elements and attributes. Each * QName object has a local name and a namespace Uniform Resource Identifier (URI). * When the value of the namespace URI is null, the QName object matches any namespace. * Use the QName constructor to create a new QName object that is either a copy of another QName * object or a new QName object with a uri from a Namespace object and a * localName from a QName object. * * *

Methods specific to E4X can use QName objects interchangeably with strings. * E4X methods are in the QName, Namespace, XML, and XMLList classes. * These E4X methods, which take a string, can also take a QName object. * This interchangeability is how namespace support works with, for example, * the XML.child() method.

* *

The QName class (along with the XML, XMLList, and Namespace classes) implements * powerful XML-handling standards defined in ECMAScript for XML * (E4X) specification (ECMA-357 edition 2).

* *

A qualified identifier evaluates to a QName object. If the QName object of an XML element is * specified without identifying a namespace, the uri * property of the associated QName object is set to the global default namespace. If the QName object of an XML * attribute is specified without identifying a namespace, the uri property is set to * an empty string.

* * @includeExample examples\QNameExample.as -noswf * * @see XML * @see XMLList * @see Namespace * @see http://www.ecma-international.org/publications/standards/Ecma-357.htm ECMAScript for XML * (E4X) specification (ECMA-357 edition 2) * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword QName */ public final class QName { /** * Creates a QName object with a uri from a Namespace object and a localName from a QName object. * If either parameter is not the expected data type, the parameter is converted to a string and * assigned to the corresponding property of the new QName object. * For example, if both parameters are strings, a new QName object is returned with a uri property set * to the first parameter and a localName property set to the second parameter. * In other words, the following permutations, along with many others, are valid forms of the constructor:
QName (uri:Namespace, localName:String);
QName (uri:String, localName: QName);
QName (uri:String, localName: String);
*

If the parameter passed as the uri parameter is the null value, * the uri property of the new QName property is set to the null value. *

*

Note: This class shows two constructor method entries because the constructor accepts * variable types of arguments. The constructor behaves differently depending on the type and number of * arguments passed, as detailed in each entry. ActionSript 3.0 does not support method or constructor overloading.

* * @param uri A Namespace object from which to copy the uri value. A parameter of any other type is converted to a string. * @param localName A QName object from which to copy the localName value. A parameter of any other type is converted to a string. * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword QName **/ public native function QName(uri:Namespace, localName:String); public native function QName(uri:Namespace, localName:QName); /** * Creates a QName object that is a copy of another QName object. If the parameter passed * to the constructor is a QName object, a copy of the QName object is created. If the parameter * is not a QName object, the parameter is converted to a string and assigned to the * localName property of the new QName instance. * If the parameter is undefined or unspecified, a new QName object * is created with the localName property set to the empty string. *

Note: This class shows two constructor method entries because the constructor accepts * variable types of arguments. The constructor behaves differently depending on the type and number of * arguments passed, as detailed in each entry. ActionSript 3.0 does not support method or constructor overloading.

* * * @param qname The QName object to be copied. Objects of any other type are * converted to a string that is assigned to the localName property * of the new QName object. * * @playerversion Flash 9 * @langversion 3.0 * @helpid **/ public native function QName(qname:QName); /** * Returns a string composed of the URI, and the local name for the * QName object, separated by "::". * *

The format depends on the uri property of the QName object:
* If uri == ""
*   toString returns localName
* else if uri == null
*   toString returns ~~::localName
* else *   toString returns uri::localName
*

* * @return The qualified name, as a string. * * @oldexample * *

Consider the following:

* *
	* var myQN:QName = QName("http://www.exampleNS.com/2005", "xx");
	* trace(myQN.toString())
	* 
* *

The Output window displays the following:

* *
	*      http://www.exampleNS.com/2005::xx
	* 
* * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword QName, QName.toString, toString **/ public native function toString():String; /** * The local name of the QName object. * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword QName, QName.localName, localName **/ public native function get localName():String; /** * The Uniform Resource Identifier (URI) of the QName object. * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword QName, QName.uri, uri **/ public native function get uri():String; } } package { /** * A RangeError exception is thrown when a numeric value is outside the acceptable range. When working with Arrays, * referring to an index position of an array item that does not exist will throw a RangeError exception. Number.toExponential(), * Number.toPrecision(), and Number.toFixed() will throw a RangeError exception in cases * where the arguments are outside the acceptable range of numbers. You can extend Number.toExponential(), * Number.toPrecision(), and Number.toFixed() to avoid throwing a RangeError. * In addition, this exception * will be thrown when: * * * @includeExample examples\RangeErrorExample.as -noswf * * @see Number#toExponential() * @see Number#toPrecision() * @see Number#toFixed() * @playerversion Flash 9 * @langversion 3.0 * @helpid x20ACB * @refpath * @keyword Error, RangeError */ public dynamic class RangeError extends Error { /** * Creates a new RangeError object. * @param message Contains the message associated with the RangeError object. */ public native function RangeError(message:String = ""); } } package { /** * A ReferenceError exception is thrown when a reference to an undefined property is * attempted on a sealed (nondynamic) object. References to undefined variables will * result in ReferenceError exceptions to inform you of potential bugs and help you troubleshoot * application code. *

However, you can refer to undefined properties of a dynamic class without having a ReferenceError thrown. For more information, see the dynamic keyword.

* * @includeExample examples\ReferenceErrorExample.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid x20ACB * @refpath * @keyword Error, ReferenceError * @see statements.html#dynamic dynamic keyword */ public dynamic class ReferenceError extends Error { /** * Creates a new ReferenceError object. * @param message Contains the message associated with the ReferenceError object. */ public native function ReferenceError(message:String = ""); } } package { // RegExp class /** * * The RegExp class lets you work with regular expressions, which are patterns that you can use * to perform searches in strings and to replace text in strings. * *

You can create a new RegExp object by using the new RegExp() constructor or by * assigning a RegExp literal to a variable:

* * var pattern1:RegExp = new RegExp("test-\d", "i"); * var pattern2:RegExp = /test-\d/i; * * *

For more information, see "Using Regular Expressions" in Programming * ActionScript 3.0.

* * @includeExample examples\RegExpExample.as -noswf * * @see String#match() * @see String#replace() * @see String#search() * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword RegExp **/ public dynamic class RegExp { /** * Lets you construct a regular expression from two strings. One string defines the pattern of the * regular expression, and the other defines the flags used in the regular expression. * * @param re The pattern of the regular expression (also known as the constructor string). This is the * main part of the regular expression (the part that goes within the "/" characters). * *

Note: Do not include the starting and trailing "/" characters; use these only when defining a regular expression * literal without using the constructor.

* * @param flags The modifiers of the regular expression. These can include the following: * * * *

All other characters in the flags string are ignored.

* * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword RegExp, RegExp.attribute, attribute **/ public native function RegExp (re:String, flags:String); /** * The default number of arguments for the constructor. You can specify 1 or no arguments. For details, see the RegExp() constructor function. * @playerversion Flash 9 * @langversion 3.0 * @see #RegExp() */ public static const length:int = 1; /** * Performs a search for the regular expression on the given string str. * *

If the g (global) flag is not set for the regular * expression, then the search starts * at the beginning of the string (at index position 0); the search ignores * the lastIndex property of the regular expression.

* *

If the g (global) flag is set for the regular * expression, then the search starts * at the index position specified by the lastIndex property of the regular expression. * If the search matches a substring, the lastIndex property changes to match the position * of the end of the match.

* * @param str The string to search. * * @return If there is no match, null; otherwise, an object with the following properties: * * * * * @example When the g (global) flag is not set in the regular expression, then you can * use exec() to find the first match in the string: * * * var myPattern:RegExp = /(\w~~)sh(\w~~)/ig; * var str:String = "She sells seashells by the seashore"; * var result:Object = myPattern.exec(str); * trace(result); * * *

The result object is set to the following:

* * * * * *

In the following example, the g (global) flag is set in the regular * expression, so you can use exec() repeatedly to find multiple matches:

* * * var myPattern:RegExp = /(\w~~)sh(\w~~)/ig; * var str:String = "She sells seashells by the seashore"; * var result:Object = myPattern.exec(str); * * while (result != null) { * trace ( result.index, "\t", result); * result = myPattern.exec(str); * } * * *

This code results in the following output:

* *

	 *	  0 	 She,,e
	 *	  10 	 seashells,sea,ells
	 *	  27 	 seashore,sea,ore
	 * 
* * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword RegExp, RegExp.exec, exec * @see String#match() * @see String#search() */ public native function exec (str:String):Object; /** * Tests for the match of the regular expression in the given string str. * *

If the g (global) flag is not set for the regular expression, * then the search starts at the beginning of the string (at index position 0); the search ignores * the lastIndex property of the regular expression.

* *

If the g (global) flag is set for the regular expression, then the search starts * at the index position specified by the lastIndex property of the regular expression. * If the search matches a substring, the lastIndex property changes to match the * position of the end of the match.

* * @param str The string to test. * * @return If there is a match, true; otherwise, false. * * @includeExample examples\RegExp.test.1.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword RegExp, RegExp.test, test */ public native function test(str:String):Boolean; /** * Specifies whether the dot character (.) in a regular expression pattern matches * new-line characters. Use the s flag when constructing * a regular expression to set dotall = true. * * @includeExample examples\RegExp.dotall.1.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword RegExp, RegExp.dotall, dotall */ public native function get dotall():Boolean; /** * Specifies whether to use extended mode for the regular expression. * When a RegExp object is in extended mode, white space characters in the constructor * string are ignored. This is done to allow more readable constructors. * *

Use the x flag when constructing a regular expression to set * extended = true.

* * @includeExample examples\RegExp.extended.1.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword RegExp * @keyword RegExp, RegExp.extended, extended */ public native function get extended():Boolean; /** * Specifies whether to use global matching for the regular expression. When * global == true, the lastIndex property is set after a match is * found. The next time a match is requested, the regular expression engine starts from * the lastIndex position in the string. Use the g flag when * constructing a regular expression to set global to true. * * @includeExample examples\RegExp.global.1.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword RegExp * @keyword RegExp, RegExp.global, global */ public native function get global():Boolean; /** * Specifies whether the regular expression ignores case sensitivity. Use the * i flag when constructing a regular expression to set * ignoreCase = true. * * @includeExample examples\RegExp.ignoreCase.1.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword RegExp * @keyword RegExp, RegExp.ignoreCase, ignoreCase **/ public native function get ignoreCase():Boolean; /** * Specifies the index position in the string at which to start the next search. This property * affects the exec() and test() methods of the RegExp class. * However, the match(), replace(), and search() methods * of the String class ignore the lastIndex property and start all searches from * the beginning of the string. * *

When the exec() or test() method finds a match and the g * (global) flag is set to true for the regular expression, the method * automatically sets the lastIndex property to the index position of the character * after the last character in the matching substring of the last match. If the * g (global) flag is set to false, the method does not * set the lastIndexproperty.

* *

You can set the lastIndex property to adjust the starting position * in the string for regular expression matching.

* * @includeExample examples\RegExp.lastIndex.1.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword RegExp * @keyword RegExp, RegExp.lastIndex, lastIndex */ public native function get lastIndex():Number; public native function set lastIndex(value:Number):void; /** * Specifies whether the m (multiline) flag is set. If it is set, * the caret (^) and dollar sign ($) in a regular expression * match before and after new lines. * Use the m flag when constructing a regular expression to set * multiline = true. * * @includeExample examples\RegExp.multiline.1.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword RegExp * @keyword RegExp, RegExp.multiline, multiline */ public native function get multiline():Boolean; /** * Specifies the pattern portion of the regular expression. * * @includeExample examples\RegExp.source.1.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword RegExp * @keyword RegExp, RegExp.source, source */ public native function get source():String; } } package flash.errors { /** * The ScriptTimeoutError exception is thrown when the script timeout interval is reached. * The script timeout interval is 15 seconds. There are two XML attributes * that you can add to the mx:Application tag: scriptTimeLimit * (the number of seconds until script timeout) and scriptRecursionLimit * (the depth of recursive calls permitted). * *

Two ScriptTimeoutError exceptions are thrown. The first exception you can catch and exit * cleanly. If there is no exception handler, the uncaught exception terminates execution. The * second exception is thrown but cannot be caught by user code; it goes to the uncaught * exception handler. It is uncatchable to prevent Flash Player from hanging * indefinitely.

* * @includeExample examples\ScriptTimeoutErrorExample.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword Error */ public dynamic class ScriptTimeoutError extends Error { /** * Creates a new ScriptTimeoutError object. * * @param message A string associated with the error object. * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword **/ function ScriptTimeoutError(message:String = "") { super(message); } } } package { /** * The SecurityError exception is thrown when some type of security violation * takes place. *

* Examples of security errors:

* * * @includeExample examples\SecurityErrorExample.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid x20ACB * @refpath * @keyword Error, SecurityError * */ public dynamic class SecurityError extends Error { /** * Creates a new SecurityError object. */ public native function SecurityError(message:String = ""); } } package flash.errors { /** * ActionScript throws a StackOverflowError exception when the stack available to the script * is exhausted. ActionScript uses a stack to store information about each method call made in * a script, such as the local variables that the method uses. The amount of stack space * available varies from system to system. * *

A StackOverflowError exception might indicate that infinite recursion has occurred, in * which case a termination case needs to be added to the function. It also might indicate * that the recursive algorithm has a proper terminating condition but has exhausted the stack * anyway. In this case, try to express the algorithm iteratively instead.

* * @includeExample examples\StackOverflowErrorExample.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword Error */ public dynamic class StackOverflowError extends Error { /** * Creates a new StackOverflowError object. * @param message A string associated with the error object. * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword **/ function StackOverflowError(message:String = "") { super(message); } } } package { /** * A StackTraceElement provides programmatic access to the elements of the call stack. * A string representation of StackTraceElement objects is returned by the Error.getStackTrace() method. * *

The StackTraceElement class is useful for writing custom exception handlers * that need to display the call stack to the developer.

* * @includeExample examples\StackTraceElementExample.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @see Error#getStackTrace() */ public class StackTraceElement { /** * The fully qualified name of the class containing the * execution point represented by this stack trace * element, or null if the execution point is not * within a class. * @playerversion Flash 9 * @langversion 3.0 */ public var className:String; /** * The name of method or function containing the execution * point represented by this stack trace element, or * null if the execution point is not within a method. * @playerversion Flash 9 * @langversion 3.0 */ public var methodName:String; /** * The name of the ActionScript file containing the execution point * represented by this stack trace element, or null if * this information is not available. * @playerversion Flash 9 * @langversion 3.0 */ public var fileName:String; /** * Line number of the execution point in the source file * specified by fileName, or null if this information * is not available. * @playerversion Flash 9 * @langversion 3.0 */ public var lineNumber:Integer; /** * The nativeMethod property value is true if the execution point is within a native method and * false otherwise. * @playerversion Flash 9 * @langversion 3.0 */ public var nativeMethod:Boolean; /** * Returns the string representation of this stack * trace element. Such as: *
      *    MyClass.method(MyClass.as:100)
      * 
* @playerversion Flash 9 * @langversion 3.0 */ public native function toString():String; } } package { //**************************************************************************** // ActionScript Standard Library // String object //**************************************************************************** /** * The String class is a data type that represents a string of characters. The String class * provides methods and properties that let you manipulate primitive string value types. * You can convert the value of any object into a String data type object using the String() * function. *

* All the methods of the String class, except for concat(), * fromCharCode(), slice(), and substr(), are * generic, which means the methods call toString() before performing their * operations, and you can use these methods with other non-String objects. *

* Because all string indexes are zero-based, the index of the last character * for any string x is x.length - 1. *

* You can call any of the methods of the String class whether you use the constructor method * new String() to create a new string variable or simply assign a string literal value. * Unlike previous versions of ActionScript, it makes no difference whether you use the constructor, * the global function, or simply assign a string literal value. The following lines of code are equivalent: *

* * var str:String = new String("foo"); * var str:String = "foo"; * var str:String = String("foo"); *

When setting a string variable to undefined, Flash Player coerces undefined * to null. So, the statement:

*
 * var s:String = undefined;
* sets the value to null instead of undefined. Use the String() * function if you need to use undefined. * @includeExample examples\StringExample.as -noswf * * @playerversion Flash 9 * * @see package.html#String() String Function * @refpath Objects/Core/String * @keyword string, string object, built-in class */ public final class String { /** * The default number of arguments for the constructor. You can specify 1 or no arguments. For details, see the String() constructor function. * @playerversion Flash 9 * @langversion 3.0 * @see #String() */ public static const length:int = 1; /** * An integer specifying the number of characters in the specified String object. *

* Because all string indexes are zero-based, the index of the last character for any * string x is x.length - 1. *

* * @playerversion Flash 9 * * @oldexample The following example creates a new String object and uses String.length to count the number of characters: *
	 * var my_str:String = "Hello world!";
* trace(my_str.length); // output: 12
*
*

The following example loops from 0 to my_str.length. * * The code checks the characters * within a string, and if the string contains the @ character, true displays in the Output panel. * * The code checks the characters within a string, and if the string contains the @ character, * true writes to the log file. * * If it does not contain the @ character, * false displays in the Output panel. * If it does not contain the @ character, * then false writes to the log file.

* *
	 * function checkAtSymbol(my_str:String):Boolean {
* for (var i = 0; i<my_str.length; i++) {
* if (my_str.charAt(i) == "@") {
* return true;
* }
* }
* return false;
* }
*
* trace(checkAtSymbol("dog@house.net")); // output: true
* trace(checkAtSymbol("Chris")); // output: false
*
*

An example is also in the Strings.fla file in the HelpExamples folder. * The following list gives typical paths to this folder:

*

* * * @helpid x209C5 * @refpath Objects/Core/String/Properties/length * @keyword string, string.length, length */ public native function get length():int /** * Returns a string comprising the characters represented by the Unicode character codes * in the parameters. * * @playerversion Flash 9 * * @param ...charCodes A series of decimal integers that represent Unicode values. * * @return The string value of the specified Unicode character codes. * * @oldexample The following example uses fromCharCode() to insert an @ character in the e-mail address: *
	* var address_str:String = "dog"+String.fromCharCode(64)+"house.net";
* trace(address_str); // output: dog@house.net
*
* * * @helpid x209BE * @refpath Objects/Core/String/Methods/fromCharCode * @keyword string, string.fromcharcode, fromcharcode, from character code */ public native static function fromCharCode(...charCodes):String; /** * Creates a new String object initialized to the specified string. * *

* Note: Because string literals use less overhead than String * objects and are generally easier to use, you should use string literals instead of the * String class unless you have a good reason to use a String object rather than a string literal. *

* * @playerversion Flash 9 * * @param val The initial value of the new String object. * * @return A reference to a String object. * * * @helpid x209C8 * @refpath Objects/Core/String/new String * @keyword string, new string, new, constructor */ public native function String(val:String); /** * Returns the character in the position specified by the index parameter. * If index is not a number from 0 to string.length - 1, an * empty string is returned. *

* This method is similar to String.charCodeAt() except that the returned * value is a character, not a 16-bit integer character code. *

* * @playerversion Flash 9 * * @param index An integer specifying the position of a character in the string. The first * character is indicated by 0, and the last character is indicated by * my_str.length - 1. * * @return The character at the specified index. Or an empty string if the * specified index is outside the range of this string's indices. * * @oldexample In the following example, this method is called on the first letter of the string "Chris": *
	 * var my_str:String = "Chris";
* var firstChar_str:String = my_str.charAt(0);
* trace(firstChar_str); // output: C
*
* * * @see #charCodeAt() * @helpid x209BA * @refpath Objects/Core/String/Methods/charAt * @keyword string, string.charat, charat, character at */ public native function charAt(index:Number = 0):String; /** * Returns the numeric Unicode character code of the character at the specified * index. If index is not a number from 0 to * string.length - 1, NaN is returned. *

* This method is similar to String.charAt() except that the returned * value is a 16-bit integer character code, not the actual character. *

* * @playerversion Flash 9 * * @param index An integer that specifies the position of a character in the string. The * first character is indicated by 0, and the last character is indicated by * my_str.length - 1. * * @return The Unicode character code of the character at the specified index. Or * NaN if the index is outside the range of this string's indices. * * @oldexample In the following example, this method is called on the first letter of the string "Chris": *
	 * var my_str:String = "Chris";
* var firstChar_num:Number = my_str.charCodeAt(0);
* trace(firstChar_num); // output: 67
*
* * * @see #charAt() * @helpid x209BB * @refpath Objects/Core/String/Methods/charCodeAt * @keyword string, string.charcodeat, charcodeat, character code at */ public native function charCodeAt(index:Number = 0):Number; /** * Appends the supplied arguments to the end of the String object, converting them to strings if * necessary, and returns the resulting string. The original value of the source String object * remains unchanged. * * @playerversion Flash 9 * * @param ...args Zero or more values to be concatenated. * * @return A new string consisting of this string concatenated * with the specified parameters. * * @oldexample The following example creates two strings and combines them using String.concat(): *
	 * var stringA:String = "Hello";
* var stringB:String = "World";
* var combinedAB:String = stringA.concat(" ", stringB);
* trace(combinedAB); // output: Hello World
*
* * * @helpid x209BC * @refpath Objects/Core/String/Methods/concat * @keyword string, string.concat, concat, concatenate */ public native function concat(...args):String; /** * Searches the string and returns the position of the first occurrence of val * found at or after startIndex within the calling string. This index is zero-based, * meaning that the first character in a string is considered to be at index 0--not index 1. If * val is not found, the method returns -1. * * @playerversion Flash 9 * * @param val The substring for which to search. * * @param startIndex An optional integer specifying the starting index of the search. * * @return The index of the first occurrence of the specified substring or -1. * * @oldexample The following examples use indexOf() to return the index of characters and substrings: *
	 * var searchString:String = "Lorem ipsum dolor sit amet.";
* var index:Number;
*
* index = searchString.indexOf("L");
* trace(index); // output: 0
*
* index = searchString.indexOf("l");
* trace(index); // output: 14
*
* index = searchString.indexOf("i");
* trace(index); // output: 6
*
* index = searchString.indexOf("ipsum");
* trace(index); // output: 6
*
* index = searchString.indexOf("i", 7);
* trace(index); // output: 19
*
* index = searchString.indexOf("z");
* trace(index); // output: -1
*
* * * @see #lastIndexOf() * @helpid x209C2 * @refpath Objects/Core/String/Methods/indexOf * @keyword string, string.indexof, indexof, index */ public native function indexOf(val:String = "undefined", startIndex:Number = 0):int; /** * Searches the string from right to left and returns the index of the last occurrence * of val found before startIndex. The index is zero-based, * meaning that the first character is at index 0, and the last is at string.length * - 1. If val is not found, the method returns -1. * * @playerversion Flash 9 * * @param val The string for which to search. * * @param startIndex An optional integer specifying the starting index from which to * search for val. The default is the maximum value allowed for an index. * If startIndex is not specified, the search starts at the last item in the string. * * @return The position of the last occurrence of the specified substring or -1 if not found. * * @oldexample The following example shows how to use lastIndexOf() to return the index of a certain character: *
	 * var searchString:String = "Lorem ipsum dolor sit amet.";
* var index:Number;
*
* index = searchString.lastIndexOf("L");
* trace(index); // output: 0
*
* index = searchString.lastIndexOf("l");
* trace(index); // output: 14
*
* index = searchString.lastIndexOf("i");
* trace(index); // output: 19
*
* index = searchString.lastIndexOf("ipsum");
* trace(index); // output: 6
*
* index = searchString.lastIndexOf("i", 18);
* trace(index); // output: 6
*
* index = searchString.lastIndexOf("z");
* trace(index); // output: -1
*
* * * @see #indexOf() * @helpid x209C3 * @refpath Objects/Core/String/Methods/lastIndexOf * @keyword string, string.lastindexof, lastindexof, last index of */ public native function lastIndexOf(val:String = "undefined", startIndex:Number=0x7FFFFFFF):int; /** * Compares the sort order of two or more strings and returns the result of the comparison as an integer. While this * method is intended to handle the comparison in a locale-specific way, the ActionScript 3.0 implementation * does not produce a different result from other string comparisons such as the equality (==) or * inequality (!=) operators. * If the strings are equivalent, the return value is 0. * If the original string value precedes the string value specified by other, * the return value is a negative integer, the absolute value of which represents * the number of characters that separates the two string values. * If the original string value comes after other, * the return value is a positive integer, the absolute value of which represents * the number of characters that separates the two string values. * * @param other A string value to compare. * @param ...values Optional set of more strings to compare. * @return The value 0 if the strings are equal. Otherwise, a negative integer if the original * string precedes the string argument and a positive integer if the string argument precedes * the original string. In both cases the absolute value of the number represents the difference * between the two strings. */ public native function localeCompare(other:String, ...values):int; /** * Matches the specifed pattern against the string and returns a new string * in which the first match of pattern is replaced with the content specified by repl. * The pattern parameter can be a string or a regular expression. The repl parameter * can be a string or a function; if it is a function, the string returned * by the function is inserted in place of the match. The original string is not modified. * *

In the following example, only the first instance of "sh" (case-sensitive) * is replaced:

* * * var myPattern:RegExp = /sh/; * var str:String = "She sells seashells by the seashore."; * trace(str.replace(myPattern, "sch")); * // She sells seaschells by the seashore. * *

In the following example, all instances of "sh" (case-sensitive) * are replaced because the g (global) flag is set in the regular expression:

* * * var myPattern:RegExp = /sh/g; * var str:String = "She sells seashells by the seashore."; * trace(str.replace(myPattern, "sch")); * // She sells seaschells by the seaschore. * *

In the following example, all instance of "sh" * are replaced because the g (global) flag is set in the regular expression * and the matches are not case-sensitive becuase the i (ignoreCase) flag is set:

* * * var myPattern:RegExp = /sh/gi; * var str:String = "She sells seashells by the seashore."; * trace(str.replace(myPattern, "sch")); * // sche sells seaschells by the seaschore. * * @param pattern The pattern to match, which can be any type of object, but it is typically * either a string or a regular expression. If you specify a pattern parameter * that is any object other than a string or a regular expression, the toString() method is * applied to the parameter and the replace() method executes using the resulting string * as the pattern. * * @param repl Typically, the string that is inserted in place of the matching content. However, you can * also specify a function as this parameter. If you specify a function, the string returned * by the function is inserted in place of the matching content. * *

When you specify a string as the repl parameter and specify a regular expression * as the pattern parameter, you can use the following special $ replacement codes * in the repl string:

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
$ Code * Replacement Text *
$$ * $ *
$& * The matched substring. *
$` * The portion of the string that precedes the matched substring. * Note that this code uses the straight left single quote character (`), * not the straight single quote character (') or the left curly single quote * character (‘). *
$' * The portion of string that follows the matched substring. * Note that this code uses the straight single quote character ('). *
$n * The nth captured parenthetical group match, where n is a single * digit 1-9 and $n is not followed by a decimal digit. *
$nn * The nnth captured parenthetical group match, where nn is a two-digit * decimal number (01-99). If the nnth capture is undefined, the replacement text * is an empty string. *
* *

For example, the following shows the use of the $2 and $1 * replacement codes, which represent the first and second capturing group matched:

* * var str:String = "flip-flop"; * var pattern:RegExp = /(\w+)-(\w+)/g; * trace(str.replace(pattern, "$2-$1")); // flop-flip * *

When you specify a function as the repl, the replace() method * passes the following parameters to the function: *

* * * *

For example, consider the following:

* * * var str1:String = "abc12 def34"; * var pattern:RegExp = /([a-z]+)([0-9]+)/; * var str2:String = str1.replace(pattern, replFN); * trace (str2); // 12abc 34def * * function replFN():String { * return arguments[2] + arguments[1]; * } * * *

The call to the replace() method uses a function as the repl * parameter. The regular expression (/([a-z]*)([0-9]*)/g) is matched twice. The * first time, the pattern matches the substring "abc12", and the following list * of arguments is passed to the function: *

* * * {"abc12", "abc", "12", 0, "abc12 def34"} * * *

The second time, the pattern matches the substring "def23", and the * following list of arguments is passed to the function: *

* * * {"def34", "def", "34", 6, "abc123 def34"} * * * @return The resulting string. Note that the source string remains unchanged. * * @see RegExp */ public native function replace(pattern:*, repl:Object):String; /** * Matches the specifed pattern against the * string. * * @param pattern The pattern to match, which can be any type of object, but it is typically * either a string or a regular expression. If the pattern is not a regular expression * or a string, then the method converts it to a string before executing. * * @return An array of strings consisting of all substrings in * the string that match the specified pattern. * *

If pattern is a regular expression, in order to return an array with * more than one matching substring, the g (global) flag must be set * in the regular expression:

* * * *

If no match is found, the method returns null. If you pass * no value (or an undefined value) as the pattern parameter, * the method returns null.

* * * @oldexample

	* 	 var myPattern:RegExp = /sh./g;  
	* 		// The dot (.) matches any character.
	*	 var str:String = "She sells seashells by the seashore.";
	*	 trace(str.match(myPattern));  
	*
	*	 	// Output: she,sho
	*
	* 	 myPattern = /sh./gi;  
	* 		// This time, make it case insensitive (with the i flag).
	*	 str = "She sells seashells by the seashore.";
	*	 trace(str.match(myPattern));  
	*
	*	 	// Output: She,she,sho	
	*
	* 	 myPattern = RegExp = new RegExp("sh(.)", "gi")  
	* 		// Note the grouping parentheses.
	*	 str = "She sells seashells by the seashore.";
	*	 trace(str.match(myPattern));  
	*
	*		// Output: She,e,she,e,sho,o
	* 	 	// Note that the result array is 
	* 		// [[She,e],[she,e],[sho,o]] 
	* 
* * @see RegExp */ public native function match(pattern:*):Array; /** * Searches for the specifed pattern and returns the index of * the first matching substring. If there is no matching substring, the method returns * -1. * * @param pattern The pattern to match, which can be any type of object but is typically * either a string or a regular expression.. If the pattern is not a regular expression * or a string, then the method converts it to a string before executing. * Note that if you specify a regular expression, the method ignores the global flag ("g") of the * regular expression, and it ignores the lastIndex property of the regular * expression (and leaves it unmodified). If you pass an undefined value (or no value), * the method returns -1. * * @return The index of the first matching substring, or -1 if * there is no match. Note that the string is zero-indexed; the first character of * the string is at index 0, the last is at string.length - 1. * * @oldexample

	*	 var str:String = "She sells seashells by the seashore.";
	* 	 var myPattern:RegExp = /sh/;  
	* 		// This time, make it case insensitive (with the i flag).
	*	 trace(str.match(myPattern));  
	*
	*		// Output: 13
	*		// (The substring match starts at character position 13.)
	*
	* 	 var myPattern:RegExp = /sh/i;
	*	 trace(str.match(myPattern));  
	*
	*		// Output: 0
	*		// (The substring match starts at character position 0 
	* 		//   -- the first character of the source string.)
	* 
* * @see RegExp */ public native function search(pattern:*):int; /** * Returns a string that includes the startIndex character * and all characters up to, but not including, the endIndex character. The original String object is not modified. * If the endIndex parameter is not specified, then the end of the * substring is the end of the string. If the character indexed by startIndex is the same as or to the right of the * character indexed by endIndex, the method returns an empty string. * * * @playerversion Flash 9 * * @param startIndex The zero-based index of the starting point for the slice. If * startIndex is a negative number, the slice is created from right-to-left, where * -1 is the last character. * * @param endIndex An integer that is one greater than the index of the ending point for * the slice. The character indexed by the endIndex parameter is not included in the extracted * string. * If endIndex is a negative number, the ending point is determined by * counting back from the end of the string, where -1 is the last character. * The default is the maximum value allowed for an index. If this parameter is omitted, String.length is used. * * @return A substring based on the specified indices. * * @oldexample The following example creates a variable, my_str, assigns it a String value, and then calls * the slice() method using a variety of values for both the start and end * parameters. * Each call to slice() is wrapped in a trace() statement that displays * the output in the Output panel. * Each call to the slice() method is wrapped in a * trace() statement that sends the output to the log file. * *
	 * // Index values for the string literal
* // positive index: 0 1 2 3 4
* // string: L o r e m
* // negative index: -5 -4 -3 -2 -1
*
* var my_str:String = "Lorem";
*
* // slice the first character
* trace("slice(0,1): "+my_str.slice(0, 1)); // output: slice(0,1): L
* trace("slice(-5,1): "+my_str.slice(-5, 1)); // output: slice(-5,1): L
*
* // slice the middle three characters
* trace("slice(1,4): "+my_str.slice(1, 4)); // slice(1,4): ore
* trace("slice(1,-1): "+my_str.slice(1, -1)); // slice(1,-1): ore
*
* // slices that return empty strings because start is not to the left of end
* trace("slice(1,1): "+my_str.slice(1, 1)); // slice(1,1):
* trace("slice(3,2): "+my_str.slice(3, 2)); // slice(3,2):
* trace("slice(-2,2): "+my_str.slice(-2, 2)); // slice(-2,2):
*
* // slices that omit the end parameter use String.length, which equals 5
* trace("slice(0): "+my_str.slice(0)); // slice(0): Lorem
* trace("slice(3): "+my_str.slice(3)); // slice(3): em
*
*

An example is also in the Strings.fla file in the HelpExamples folder. * The following list gives typical paths to this folder: *

*

*
* * @see #substr() * @see #substring() * @helpid x209CB * @refpath Objects/Core/String/Methods/slice * @keyword string, string.slice, slice */ public native function slice(startIndex:Number = 0, endIndex:Number = 0x7fffffff):String; /** * Splits a String object into an array of substrings * by dividing it wherever the specified delimiter parameter * occurs. * *

If the delimiter parameter is a regular expression, only * the first match at a given position of the string is considered, * even if backtracking could find a nonempty substring match at that * position. For example:

* * * var str:String = "ab"; * var results:Array = str.split(/a~~?/); // results == ["","b"] * * results = str.split(/a~~/); // results == ["","b"].) * * *

If the delimiter parameter is a regular expression * containing grouping parentheses, then each time the * delimiter is matched, the results (including any * undefined results) of the grouping parentheses are spliced into the * output array. For example

* * * var str:String = "Thi5 is a tricky-66 example."; * var re:RegExp = /(\d+)/; * var results:Array = str.split(re); * // results == ["Thi","5"," is a tricky-","66"," example."] * * *

If the limit parameter is specified, then * the returned array will have no more than the specified * number of elements.

*

If the delimiter is an empty string, an empty * regular expression, or a regular expression that can match an empty * string, each single character in the string * is ouput as an element in the array.

* *

If the delimiter parameter is undefined, the entire * string is placed into the first element of the returned * array.

* * @playerversion Flash 9 * * @param delimiter The pattern that specifies where to split this string. This can be any type of * object but is typically either a string or a regular expression. If the delimiter * is not a regular expression or string, then the method converts it to a string before executing. * * @param limit The maximum number of items to place into the array. * The default is the maximum value allowed. * * * @return An array of substrings. * * * * @see Array#join() * @see RegExp * @helpid x209CC * @refpath Objects/Core/String/Methods/split * @keyword string, string.split, split */ public native function split(delimiter:*, limit:Number = 0x7fffffff):Array; /** * Returns a substring consisting of the characters that start at the specified * startIndex and with a length specified by len. The original * string is unmodified. * * @playerversion Flash 9 * * @param startIndex An integer that specified the index of the first character to be * used to create the substring. If startIndex is a negative number, the * starting index is determined from the end of the string, where -1 is the * last character. * * @param len The number of characters in the substring being created. * The default value is the maximum value allowed. If len * is not specified, the substring includes all the characters from startIndex * to the end of the string. * * @return A substring based on the specified parameters. * * @oldexample The following example creates a new string, my_str and uses substr() to return the second word in the string; first, using a positive start parameter, and then using a negative start parameter: *
	 * var my_str:String = new String("Hello world");
* var mySubstring:String = new String();
* mySubstring = my_str.substr(6,5);
* trace(mySubstring); // output: world
*
* mySubstring = my_str.substr(-5,5);
* trace(mySubstring); // output: world
*
*

An example is also in the Strings.fla file in the HelpExamples folder. The following list gives typical paths to this folder:

*
* * * @helpid x209CD * @refpath Objects/Core/String/Methods/substr * @keyword string, string.substr, substr, substring */ public native function substr(startIndex:Number = 0, len:Number = 0x7fffffff):String; /** * Returns a string consisting of the character specified by startIndex * and all characters up to endIndex - 1. If endIndex is not * specified, String.length is used. If the value of startIndex * equals the value of endIndex, the method returns an empty string. * If the value of startIndex is greater than the value of * endIndex, the parameters are automatically swapped before the function * executes. The original string is unmodified. * * @playerversion Flash 9 * * @param startIndex An integer specifying the index of the first character used to create * the substring. Valid values for startIndex are 0 through * String.length. If startIndex is a negative value, 0 * is used. * * @param endIndex An integer that is one greater than the index of the last character in the * extracted substring. Valid values for endIndex are 0 through * String.length. The character at endIndex is not included in * the substring. The default is the maximum value allowed for an index. * If this parameter is omitted, String.length is used. If * this parameter is a negative value, 0 is used. * * @return A substring based on the specified parameters. * * @oldexample The following example shows how to use substring(): *
	 * var my_str:String = "Hello world";
* var mySubstring:String = my_str.substring(6,11);
* trace(mySubstring); // output: world
*
*

The following example shows what happens if a negative start parameter is used:

*
	 * var my_str:String = "Hello world";
* var mySubstring:String = my_str.substring(-5,5);
* trace(mySubstring); // output: Hello
*
*

An example is also in the Strings.fla file in the Examples folder. The following list gives typical paths to this folder:

*
* * * @helpid x209CE * @refpath Objects/Core/String/Methods/substring * @keyword string, string.substring, substring */ public native function substring(startIndex:Number = 0, endIndex:Number = 0x7fffffff):String; /** * Returns a copy of this string, with all uppercase characters converted * to lowercase. The original string is unmodified. * *

This method converts all characters (not simply A-Z) for which Unicode lowercase * equivalents exist:

* * * var str:String = " JOSÉ BARÇA"; * trace(str.toLowerCase()); // josé barça * *

These case mappings are defined in the * UnicodeData.txt file and the * SpecialCasings.txt file, as defined * in the Unicode Character Database * specification.

* * @playerversion Flash 9 * * @return A copy of this string with all uppercase characters converted * to lowercase. * * @see #toUpperCase() * @helpid x209CF * @refpath Objects/Core/String/Methods/toLowerCase * @keyword string, string.tolowercase, tolowercase, to lowercase */ public native function toLowerCase():String; /** * Returns a copy of this string, with all uppercase characters converted * to lowercase. The original string is unmodified. While this * method is intended to handle the conversion in a locale-specific way, the ActionScript 3.0 implementation * does not produce a different result from the toLowerCase() method. * * @return A copy of this string with all uppercase characters converted * to lowercase. * * @see #toLowerCase() */ public native function toLocaleLowerCase():String; /** * Returns a copy of this string, with all lowercase characters converted * to uppercase. The original string is unmodified. * *

This method converts all characters (not simply a-z) for which Unicode uppercase * equivalents exist:

* * * var str:String = "José Barça"; * trace(str.toUpperCase()); // JOSÉ BARÇA * *

These case mappings are defined in the * UnicodeData.txt file and the * SpecialCasings.txt file, as defined * in the Unicode Character Database * specification.

* * @playerversion Flash 9 * * @return A copy of this string with all lowercase characters converted * to uppercase. * * * @see #toLowerCase() * @helpid x209D0 * @refpath Objects/Core/String/Methods/toUpperCase * @keyword string, string.touppercase, touppercase, to uppercase */ public native function toUpperCase():String; /** * Returns a copy of this string, with all lowercase characters converted * to uppercase. The original string is unmodified. While this * method is intended to handle the conversion in a locale-specific way, the ActionScript 3.0 implementation * does not produce a different result from the toUpperCase() method. * * @playerversion Flash 9 * * @return A copy of this string with all lowercase characters converted * to uppercase. * * @see #toUpperCase() */ public native function toLocaleUpperCase():String; /** * Returns the primitive value of a String instance. This method is designed to * convert a String object into a primitive string value. Because Flash Player * automatically calls valueOf() when necessary, * you rarely need to explicitly call this method. * * @playerversion Flash 9 * * @return The value of the string. * * @oldexample The following example creates a new instance of the String class * and then shows that the valueOf method returns * the primitive value, rather than a reference to the new instance. * * * var str:String = new String("Hello World"); * var value:String = str.valueOf(); * trace(str instanceof String); // true * trace(value instanceof String); // false * trace(str === value); // false * * * @langversion 3.0 */ public native function valueOf():String; } } package { /** * A SyntaxError exception is thrown when a parsing error occurs. * * * * @see RegExp RegExp class * @see XML XML class * @playerversion Flash 9 * @langversion 3.0 * @helpid x20ACB * @refpath * @keyword Error, SyntaxError */ public dynamic class SyntaxError extends Error { /** * Creates a new SyntaxError object. */ public native function SyntaxError(message:String = ""); } } package { /** * A TypeError exception is thrown when the actual type of an operand is different * from the expected type. *

* In addition, this exception is thrown when: *

*

* * @see operators.html#is is operator * @see operators.html#instanceof instanceof operator * @see statements.html#super super statement * @see RegExp RegExp class * @includeExample examples\TypeErrorExample.as -noswf * * * @playerversion Flash 9 * @langversion 3.0 * @helpid x20ACB * @refpath * @keyword Error, TypeError * */ public dynamic class TypeError extends Error { /** * Creates a new TypeError object. */ public native function TypeError(message:String = ""); } } package { /** * The uint class provides methods for working with a data type representing a 32-bit unsigned integer. Because an unsigned integer can only be * positive, its maximum value is twice that of the int class. *

The range of values represented by the uint class is 0 to 4,294,967,295 (2^32-1).

*

You can create a uint object by declaring a variable of type uint and assigning the variable a literal value. The default value of a variable of type uint is 0.

*

The uint class is primarily useful for pixel color values (ARGB and RGBA) and other situations where * the int data type does not work well. For example, the number 0xFFFFFFFF, which * represents the color value white with an alpha value of 255, can't be represented * using the int data type because it is not within the valid range of the int values.

* *

The following example creates a uint object and calls the * toString() method:

*
 * var myuint:uint = 1234;
 * trace(myuint.toString()); // output: 1234
 * 
*

The following example assigns the value of the MIN_VALUE * property to a variable without the use of the constructor:

*
 * var smallest:uint = uint.MIN_VALUE;
 * trace(smallest.toString()); // output: 0
 * 
* * @includeExample examples\UintExample.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * * @helpid x2097D * @refpath Objects/Core/uint * @keyword uint object, uint, built-in class * @see int.html int * @see Number.html Number */ public final class uint { /** * The largest representable 32-bit unsigned integer, which is 4,294,967,295. * * @playerversion Flash 9 * @langversion 3.0 * * @example The following ActionScript displays the largest and smallest representable * uint values: *
	* trace("uint.MIN_VALUE = " + uint.MIN_VALUE);
	* trace("uint.MAX_VALUE = " + uint.MAX_VALUE);
	* 
*

The values are:

*
	* uint.MIN_VALUE = 0
	* uint.MAX_VALUE = 4294967295
	* 
* * @helpid x20964 * @refpath Objects/Core/uint/Constants/MAX_VALUE * @keyword uint, uint.max_value, max_value, max value */ public static const MAX_VALUE:uint = 4294967295; /** * The smallest representable unsigned integer, which is 0. * * @playerversion Flash 9 * @langversion 3.0 * * @example The following ActionScript displays the largest and smallest representable * uint values: *
	 * trace("uint.MIN_VALUE = " + uint.MIN_VALUE);
	 * trace("uint.MAX_VALUE = " + uint.MAX_VALUE);
	 * 
*

The values are:

*
	 * uint.MIN_VALUE = 0
	 * uint.MAX_VALUE = 4294967295
	 * 
* * @helpid x2096B * @refpath Objects/Core/uint/Constants/MIN_VALUE * @keyword uint, uint.min_value, min_value, min value */ public static const MIN_VALUE:uint = 0; /** * Creates a new uint object. You can create a variable of uint type and assign it a literal value. The new uint() constructor is primarily used * as a placeholder. A uint object is not the same as the * uint() function, which converts a parameter to a primitive value. * * @playerversion Flash 9 * @langversion 3.0 * * @param num The numeric value of the uint object being created, * or a value to be converted to a number. If num is not provided, * the default value is 0. * * @return A reference to a uint object. * * @example The following code constructs two new uint objects; the first by assigning a literal value, and the second by using the constructor function: *
	 * var n1:uint = 3;
	 * var n2:uint = new uint(10);
	 * 
* * @helpid x2097C * @refpath Objects/Core/uint/new uint * @keyword new number, constructor */ public native function uint(num:Object); /** * Returns the string representation of a uint object. * * @playerversion Flash 9 * @langversion 3.0 * * @usage myuint.toString(radix:uint) : String * * @param radix Specifies the numeric base (from 2 to 36) to use for the * number-to-string conversion. If you do not specify the radix * parameter, the default value is 10. * * @return The string representation of the uint object. * * @example The following example uses 2 and 8 for the radix * parameters and returns a string value with the corresponding * representation of the number 9: *
	 * var myuint:uint = 9;
	 * trace(myuint.toString(2)); // output: 1001
	 * trace(myuint.toString(8)); // output: 11
	 * 
* The following example creates hexadecimal values: *
	 * var r:uint = 250;
	 * var g:uint = 128;
	 * var b:uint = 114;
	 * var rgb:String = "0x" + r.toString(16) + g.toString(16) + b.toString(16);
	 * trace(rgb); // output: 0xFA8072 (Hexadecimal equivalent of the color 'salmon')
	 * 
* * @helpid x2097E * @refpath Objects/Core/uint/Methods/toString * @keyword uint, uint.tostring, tostring */ public native function toString(radix:uint):String; /** * Returns the primitive uint type value of the specified * uint object. * * @playerversion Flash 9 * @langversion 3.0 * * @return The primitive uint type value of this uint * object. * * @example The following example outputs the primitive value of the * numSocks object. *
	 * var numSocks:uint = 2;
	 * trace(numSocks.valueOf()); // output: 2
	 * 
* * @helpid x20A24 * @refpath Objects/Core/uint/Methods/valueOf * @keyword number, number.valueof, valueof, value of */ public native function valueOf():uint; } } package { /** * A URIError exception is thrown when one of the global URI handling functions is used * in a way that is incompatible with its definition. This exception is thrown when an invalid * URI is specified to a Flash * Player API function that expects a valid URI, such as the Socket.connect() * method or the XML.load() method. * * * @playerversion Flash 9 * @langversion 3.0 * @helpid x20ACB * @refpath * @keyword Error, URIError * * @see flash.net.Socket#connect() * @see XML#load() */ public dynamic class URIError extends Error { /** * Creates a new URIError object. * @param message Contains the message associated with the URIError object. */ public native function URIError(message:String = ""); } } package { //**************************************************************************** // ActionScript Standard Library // VerifyError object //**************************************************************************** /** * The VerifyError class represents an error that occurs when a malformed * or corrupted SWF file is encountered. * * @tiptext An VerifyError is thrown when a malformed or corrupted SWF File is encountered. * * @includeExample * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword Error * @see flash.display.Loader Loader class */ public dynamic class VerifyError extends Error { /** * Creates a new VerifyError object. * @param message Contains the message associated with the VerifyError object. */ public native function VerifyError(message:String = ""); } } package { // // XML // // Based on the ECMA E4X Specification, 2nd Edition /** * The XML class contains methods and properties for working with XML objects. The XML class * (along with the XMLList, Namespace, and QName classes) implements the * powerful XML-handling standards defined in ECMAScript for XML * (E4X) specification (ECMA-357 edition 2). * *

Use the toXMLString() method to return a string representation of the XML object * regardless of whether the XML object has simple content or complex content.

* *

Note: The XML class (along with related classes) from ActionScript 2.0 has been * renamed XMLDocument and moved into the flash.xml package. * It is included in ActionScript 3.0 for backward compatibility.

* * * @includeExample examples\XMLExample.as -noswf * * @see Namespace * @see QName * @see XMLList * @see XML#toXMLString() * @see http://www.ecma-international.org/publications/standards/Ecma-357.htm ECMAScript for XML * (E4X) specification (ECMA-357 edition 2) * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML */ public final dynamic class XML extends Object { /** * The default number of arguments for the constructor. You can specify 1 or no arguments. For details, see the XML() constructor function. * @playerversion Flash 9 * @langversion 3.0 * @see #XML() */ public static const length:int = 1; /** * Creates a new XML object. You must use the constructor to create an * XML object before you call any of the methods of the XML class. * *

Use the toXMLString() method to return a string representation of the XML object * regardless of whether the XML object has simple content or complex content.

* * @param value Any object that can be converted to XML with the top-level * XML() function. * * @see package.html#XML() top-level XML() function * @see XML#toXMLString() * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML **/ public native function XML(value:Object); /** * Adds a namespace to the set of in-scope namespaces for the XML object. If the namespace already * exists in the in-scope namespaces for the XML object (with a prefix matching that of the given * parameter), then the prefix of the existing namespace is set to undefined. If the input parameter * is a Namespace object, it's used directly. If it's a QName object, the input parameter's * URI is used to create a new namespace; otherwise, it's converted to a String and a namespace is created from * the String. * * @param ns The namespace to add to the XML object. * * @return The new XML object, with the namespace added. * * @includeExample examples\XML.addNamespace.1.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.addNamespace, addNamespace **/ public native function addNamespace (ns:Object):XML; /** * Appends the given child to the end of the XML object's properties. * The appendChild() method takes an XML object, an XMLList object, or * any other data type that is then converted to a String. * * @return The resulting XML object. * * @param child The XML object to append. * * @oldexample Consider the following: * * var grp = <orchestra> * <musician id="0" ><name>George</name><instrument>cello</instrument></musician> * <musician id="1" ><name>Sam</name></musician> * </orchestra>; * * *

Add a new instrument element to the end of musician element for Sam: *

grp.musician.(name == "George").appendChild(<instrument>cello</instrument>); * Here is the resulting XML, which the method returns: * var grp = <orchestra> * <musician id="0" ><name>George</name><instrument>cello</instrument></musician> * <musician id="1" ><<name>Sam</name><instrument>cello</instrument></musician> * </orchestra>; * *

* * @includeExample examples\XML.appendChild.1.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.appendChild, appendChild **/ public native function appendChild ( child:Object ):XML; /** * Returns the XML value of the attribute that has the name matching the attributeName * parameter. Attributes are found within XML elements. * In the following example, the element has an attribute named "gender" * with the value "boy": <first gender="boy">John</first>. * *

The attributeName parameter can be any data type; however, * String is the most common data type to use. When passing any object other than a QName object, * the attributeName parameter uses the toString() method * to convert the parameter to a string.

* *

If you need a qualified name reference, you can pass in a QName object. A QName object * defines a namespace and the local name, which you can use to define the qualified name of an * attribute. Therefore calling attribute(qname) is not the same as calling * attribute(qname.toString()).

* * @includeExample examples\XMLAttributeExample1.as -noswf * @includeExample examples\XMLAttributeExample2.as -noswf * * @param attributeName The name of the attribute. * * @return An XMLList object or an empty XMLList object. Returns an empty XMLList object * when an attribute value has not been defined. * * @see XML#attributes() * @see QName * @see Namespace * @see XML#elements() * @see operators.html#attribute_identifier attribute identifier (@) operator * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.attribute, attribute **/ public native function attribute (attributeName:*):XMLList; /** * Returns a list of attribute values for the given XML object. Use the name() * method with the attributes() method to return the name of an attribute. * Use @~~ to return the names of all attributes. * * @return The list of attribute values. * * @includeExample examples\XMLAttributesExample1.as -noswf * @includeExample examples\XMLAttributesExample2.as -noswf * * @see XML#attribute() * @see XML#name() * @see operators.html#attribute_identifier @ operator * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.attributes, attributes **/ public native function attributes():XMLList; /** * Lists the children of an XML object. An XML child is an XML element, text node, comment, * or processing instruction. * *

Use the propertyName parameter to list the * contents of a specific XML child. For example, to return the contents of a child named * <first>, use child.name("first"). You can generate the same result * by using the child's index number. The index number identifies the child's position in the * list of other XML children. For example, name.child(0) returns the first child * in a list.

* *

Use an asterisk (~~) to output all the children in an XML document. * For example, doc.child("~~").

* *

Use the length() method with the asterisk (~~) parameter of the * child() method to output the total number of children. For example, * numChildren = doc.child("~~").length().

* * @param propertyName The element name or integer of the XML child. * * @return An XMLList object of child nodes that match the input parameter. * * @includeExample examples\XML.child.1.as -noswf * * @see XML#elements() * @see XMLList XMLList class * @see XML#length() * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.child, child **/ public native function child(propertyName:Object):XMLList; /** * Identifies the zero-indexed position of this XML object within the context of its parent. * * @return The position of the object. Returns -1 as well as positive integers. * * @includeExample examples\XML.childIndex.1.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.childindex, childindex **/ public native function childIndex():int; /** * Lists the children of the XML object in the sequence in which they appear. An XML child * is an XML element, text node, comment, or processing instruction. * * @return An XMLList object of the XML object's children. * * @includeExample examples\XML.children.1.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.children, children **/ public native function children():XMLList; /** * Lists the properties of the XML object that contain XML comments. * * @return An XMLList object of the properties that contain comments. * * @includeExample examples\XML.comments.1.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.comments, comments **/ public native function comments():XMLList; /** * Compares the XML object against the given value parameter. * * @param value A value to compare against the current XML object. * * @return If the XML object matches the value parameter, then true; otherwise false. * * @includeExample examples\XML.contains.1.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.contains, contains **/ public native function contains (value:XML):Boolean; /** * Returns a copy of the given XML object. The copy is a duplicate of the entire tree of nodes. * The copied XML object has no parent and returns null if you attempt to call the * parent() method. * * @return The copy of the object. * * @includeExample examples\XML.copy.1.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.copy, copy **/ public native function copy():XML; /** * Returns all descendants (children, grandchildren, great-grandchildren, and so on) of the * XML object that have the given name parameter. The name parameter * is optional. The name parameter can be a QName object, a String data type * or any other data type that is then converted to a String data type. * *

To return all descendants, use the "~~" parameter. If no parameter is passed, * the string "~~" is passed and returns all descendants of the XML object.

* * @param name The name of the element to match. * * @return An XMLList object of matching descendants. If there are no descendants, returns an * empty XMLList object. * * @includeExample examples\XMLDescendantsExample1.as -noswf * * @see operators.html#descendant_accessor descendant accessor (..) operator * * @includeExample examples\XML.descendants.1.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.descendants, descendants **/ public native function descendants (name:Object="*"):XMLList; /** * Returns an object with the following properties set to the default values: ignoreComments, * ignoreProcessingInstructions, ignoreWhitespace, prettyIndent, and * prettyPrinting. The default values are as follows: * * * *

Note: You do not apply this method to an instance of the XML class; you apply it to * XML, as in the following code: var df:Object = XML.defaultSettings().

* * @return An object with properties set to the default settings. * * @includeExample examples\XML.defaultSettings.1.as -noswf * * @see XML#ignoreComments * @see XML#ignoreProcessingInstructions * @see XML#ignoreWhitespace * @see XML#prettyIndent * @see XML#prettyPrinting * @see XML#setSettings() * @see XML#settings() * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.defaultSettings, defaultSettings **/ public native static function defaultSettings ():Object; /** * Lists the elements of an XML object. An element consists of a start and an end tag; * for example <first></first>. The name parameter * is optional. The name parameter can be a QName object, a String data type, * or any other data type that is then converted to a String data type. Use the name parameter to list a specific element. For example, * the element "first" returns "John" in this example: * <first>John</first>. * *

To list all elements, use the asterisk (~~) as the * parameter. The asterisk is also the default parameter.

* *

Use the length() method with the asterisk parameter to output the total * number of elements. For example, numElement = addressbook.elements("~~").length().

* * @param name The name of the element. An element's name is surrounded by angle brackets. * For example, "first" is the name in this example: * <first></first>. * * @return An XMLList object of the element's content. The element's content falls between the start and * end tags. If you use the asterisk (~~) to call all elements, both the * element's tags and content are returned. * * @includeExample examples\XML.elements.1.as -noswf * * @includeExample examples\XMLElementsExample1.as -noswf * * @see XML#child() * @see XMLList XMLList class * @see XML#length() * @see XML#attribute() * @see operators.html#dot_(XML) XML dot (.) operator * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.elements, elements **/ public native function elements ( name:Object="*" ):XMLList; /** * Checks to see whether the object has the property specified by the p parameter. * * @param p The property to match. * * @return If the property exists, true; otherwise false. * * @includeExample examples\XML.hasOwnProperty.1.as -noswf * * @includeExample examples\XML.hasOwnProperty.2.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.hasOwnProperty, hasOwnProperty **/ public native function hasOwnProperty ( p:String ):Boolean; /** * Checks to see whether the XML object contains complex content. An XML object contains complex content if * it has child elements. XML objects that representing attributes, comments, processing instructions, * and text nodes do not have complex content. However, an object that contains these can * still be considered to contain complex content (if the object has child elements). * * @return If the XML object contains complex content, true; otherwise false. * * @includeExample examples\XML.hasComplexContent.1.as -noswf * * @see XML#hasSimpleContent() * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.hasComplexContent, hasComplexContent **/ public native function hasComplexContent( ):Boolean; /** * Checks to see whether the XML object contains simple content. An XML object contains simple content * if it represents a text node, an attribute node, or an XML element that has no child elements. * XML objects that represent comments and processing instructions do not contain simple * content. * * @return If the XML object contains simple content, true; otherwise false. * * @includeExample examples\XML.hasComplexContent.1.as -noswf * * @see XML#hasComplexContent() * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.hasSimpleContent, hasSimpleContent **/ public native function hasSimpleContent( ):Boolean; /** * Lists the namespaces for the XML object, based on the object's parent. * * @return An array of Namespace objects. * * @includeExample examples\XML.inScopeNamespaces.1.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.inScopeNamespaces, inScopeNamespaces **/ public native function inScopeNamespaces( ):Array; /** * Inserts the given child2 parameter after the child1 parameter in this XML object and returns the * resulting object. If the child1 parameter is null, the method * inserts the contents of child2 before all children of the XML object * (in other words, after none). If child1 is provided, but it does not * exist in the XML object, the XML object is not modified and undefined is * returned. * *

If you call this method on an XML child that is not an element (text, attributes, comments, pi, and so on) * undefined is returned.

* * @param child1 The object in the source object that you insert before child2. * @param child2 The object to insert. * * @return The resulting XML object or undefined. * * @includeExample examples\XML.insertChildAfter.1.as -noswf * * @see XML#insertChildBefore() * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.insertChildAfter, insertChildAfter **/ public native function insertChildAfter ( child1:Object , child2:Object):*; /** * Inserts the given child2 parameter before the child1 parameter * in this XML object and returns the resulting object. If the child1 parameter * is null, the method inserts the contents of * child2 after all children of the XML object (in other words, before * none). If child1 is provided, but it does not exist in the XML object, * the XML object is not modified and undefined is returned. * *

If you call this method on an XML child that is not an element (text, attributes, * comments, pi, and so on) undefined is returned.

* * @param child1 The object in the source object that you insert after child2. * @param child2 The object to insert. * * @return The resulting XML object or undefined. * * @includeExample examples\XML.insertChildBefore.1.as -noswf * * @see XML#insertChildAfter() * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.insertChildBefore, insertChildBefore **/ public native function insertChildBefore ( child1:Object , child2:Object):*; /** * For XML objects, this method always returns the integer 1. * The length() method of the XMLList class returns a value of 1 for * an XMLList object that contains only one value. * * @return Always returns 1 for any XML object. * * @includeExample examples\XML.length.1.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.length, length **/ public native function length ( ):int; /** * Gives the local name portion of the qualified name of the XML object. * * @return The local name as either a String or null. * * @includeExample examples\XML.localName.1.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.localName, localName **/ public native function localName ( ):Object; /** * Gives the qualified name for the XML object. * * @return The qualified name is either a QName or null. * * @includeExample examples\XML.name.1.as -noswf * * @includeExample examples\XML.name.2.as -noswf * * @see XML#attributes() * @see operators.html#attribute_identifier * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.name, name **/ public native function name ( ):Object; /** * If no parameter is provided, gives the namespace associated with the qualified name of * this XML object. If a prefix parameter is specified, the method returns the namespace * that matches the prefix parameter and that is in scope for the XML object. If there is no * such namespace, the method returns undefined. * * @param prefix The prefix you want to match. * * @return Returns null, undefined, or a namespace. * * @includeExample examples\XML.namespace.1.as -noswf * * @includeExample examples\XML.namespace.2.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.namespace, namespace **/ public native function namespace ( prefix:String = null ):*; /** * Lists namespace declarations associated with the XML object in the context of its parent. * * @return An array of Namespace objects. * * @includeExample examples\XML.namespaceDeclarations.1.as -noswf * * @see XML#namespace() * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.namespaceDeclarations, namespaceDeclarations **/ public native function namespaceDeclarations ( ): Array; /** * Specifies the type of node: text, comment, processing-instruction, * attribute, or element. * * @return The node type used. * * @includeExample examples\XMLNodeKindExample1.as -noswf * * @see Operators.html#attribute_identifier * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.nodeKind, nodeKind **/ public native function nodeKind ( ):String; /** * For the XML object and all descendant XML objects, merges adjacent text nodes and * eliminates empty text nodes. * * @return The resulting normalized XML object. * * @includeExample examples\XML.normalize.1.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.normalize, normalize **/ public native function normalize ( ):XML; /** * Returns the parent of the XML object. If the XML object has no parent, the method returns * undefined. * * @return The parent XML object. Returns either a String or undefined. * * @includeExample examples\XML.parent.1.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.parent, parent **/ public native function parent ( ):*; /** * If a name parameter is provided, lists all the children of the XML object * that contain processing instructions with that name. With no parameters, the method * lists all the children of the XML object that contain any processing instructions. * * @param name The name of the processing instructions to match. * * @return A list of matching child objects. * * @includeExample examples\XML.processingInstructions.1.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.processingInstructions, processingInstructions **/ public native function processingInstructions ( name:String = "*" ):XMLList; /** * Inserts a copy of the provided child object into the XML element before any existing XML * properties for that element. * * @param value The object to insert. * * @return The resulting XML object. * * @includeExample examples\XML.prependChild.1.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.prependChild, prependChild **/ public native function prependChild ( value:Object ):XML; /** * Checks whether the property p is in the set of properties that can be iterated in a * for..in statement applied to the XML object. Returns true only * if toString(p) == "0". * * @param p The property that you want to check. * * @return If the property can be iterated in a for..in statement, true; * otherwise, false. * * @includeExample examples\XML.propertyIsEnumerable.1.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.propertyIsEnumerable, propertyIsEnumerable **/ public native function propertyIsEnumerable ( p:String ):Boolean; /** * Removes the given namespace for this object and all descendants. The removeNamespaces() * method does not remove a namespace if it is referenced by the object's qualified name or the * qualified name of the object's attributes. * * @param ns The namespace to remove. * * @return A copy of the resulting XML object. * * @includeExample examples\XML.removeNamespace.1.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.removeNamespace, removeNamespace **/ public native function removeNamespace ( ns:Namespace ):XML; /** * Replaces the properties specified by the propertyName parameter * with the given value parameter. * If no properties match propertyName, the XML object is left unmodified. * * @param propertyName Can be a * numeric value, an unqualified name for a set of XML elements, a qualified name for a set of * XML elements, or the asterisk wildcard ("*"). * Use an unqualified name to identify XML elements in the default namespace. * * @param value The replacement value. This can be an XML object, an XMLList object, or any value * that can be converted with toString(). * * @return The resulting XML object, with the matching properties replaced. * * @includeExample examples\XML.replace.1.as -noswf * * @includeExample examples\XML.replace.2.as -noswf * * @includeExample examples\XML.replace.3.as -noswf * * @includeExample examples\XML.replace.4.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.replace, replace **/ public native function replace ( propertyName:Object , value:XML ):XML /** * Replaces the child properties of the XML object with the specified set of XML properties, * provided in the value parameter. * * @param value The replacement XML properties. Can be a single XML object or an XMLList object. * * @return The resulting XML object. * * @includeExample examples\XML.setChildren.1.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.setChildren, setChildren **/ public native function setChildren ( value:Object ):XML; /** * Changes the local name of the XML object to the given name parameter. * * @param name The replacement name for the local name. * * @includeExample examples\XML.setLocalName.1.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.setLocalName, setLocalName **/ public native function setLocalName ( name:String ):void; /** * Sets the name of the XML object to the given qualified name or attribute name. * * @param name The new name for the object. * * @includeExample examples\XML.setName.1.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.setName, setName **/ public native function setName ( name:String ):void; /** * Sets the namespace associated with the XML object. * * @param ns The new namespace. * * @includeExample examples\XML.setNamespace.1.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.setNamespace, setNamespace **/ public native function setNamespace ( ns:Namespace ):void; /** * Sets values for the following XML properties: ignoreComments, * ignoreProcessingInstructions, ignoreWhitespace, * prettyIndent, and prettyPrinting. * * The following are the default settings, which are applied if no setObj parameter * is provided: * * * *

Note: You do not apply this method to an instance of the XML class; you apply it to * XML, as in the following code: XML.setSettings().

* * @param rest An object with each of the following properties: * * * * @includeExample examples\XML.defaultSettings.1.as -noswf * * @see #ignoreComments * @see #ignoreProcessingInstructions * @see #ignoreWhitespace * @see #prettyIndent * @see #prettyPrinting * @see #defaultSettings() * @see #settings() * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.setSettings, setSettings **/ public native static function setSettings (... rest):void; /** * Retrieves the following properties: ignoreComments, * ignoreProcessingInstructions, ignoreWhitespace, * prettyIndent, and prettyPrinting. * * @return An object with the following XML properties: * * * @includeExample examples\XML.defaultSettings.1.as -noswf * * @see XML#ignoreComments * @see XML#ignoreProcessingInstructions * @see XML#ignoreWhitespace * @see XML#prettyIndent * @see XML#prettyPrinting * @see XML#defaultSettings() * @see XML#setSettings() * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.settings, settings **/ public native static function settings ():Object; /** * Returns an XMLList object of all XML properties of the XML object that represent XML text nodes. * * @return The list of properties. * * @includeExample examples\XML.text.1.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.text, text **/ public native function text ( ):XMLList; /** * Returns a string representation of the XML object. The rules for this conversion depend on whether * the XML object has simple content or complex content: * * * * * *

To return the entire XML object every time, use toXMLString().

* * * @return The string representation of the XML object. * * @includeExample examples\XMLToStringExample1.as -noswf * @includeExample examples\XMLToStringExample2.as -noswf * * @see XML#hasSimpleContent() * @see XML#hasComplexContent() * @see XML#toXMLString() * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.toString, toString * **/ public native function toString():String; /** * Returns a string representation of the XML object. Unlike the toString() method, * the toXMLString() method always returns the start tag, attributes, * and end tag of the XML object, regardless of whether the XML object has simple content or complex * content. (The toString() method strips out these items for XML objects that contain * simple content.) * * @oldexample The following XML object has simple content: * * <item>wiper blade</item> * *

The toString() method for this object returns the following String: *

<item>wiper blade</item> *

* *

* The following XML object has complex content: *

* <student> * <first-name>Bob</first-name> * <last-name>Roberts</last-name> * </student> * *

* *

* The toString() method for this object returns the following String: *

<student><first-name>Bob</first-name><last-name>Roberts</last-name></student> *

* *

* Note: The white space formatting of the returned String depends on the setting of the * prettyPrintingproperty of the XML class. In this example, prettyPrinting * is set to false. *

* * @return The string representation of the XML object. * * @includeExample examples\XML.toXMLString.1.as -noswf * * @see XML#toString() * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.toXMLString, toXMLString **/ public native function toXMLString ( ):String; /** * Returns the XML object. * * @return Returns the primitive value of an XML instance. * * @includeExample examples\XML.valueOf.1.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.valueOf, valueOf **/ public native function valueOf ( ):XML; /** * Determines whether XML comments are ignored * when XML objects parse the source XML data. By default, the comments are ignored * (true). To include XML comments, set this property to false. * The ignoreComments property is used only during the XML parsing, not during * the call to any method such as myXMLObject.child(~~).toXMLString(). * If the source XML includes comment nodes, they are kept or discarded during the XML parsing. * * @includeExample examples\XML.ignoreComments.1.as -noswf * * @see XML#child() * @see XML#toXMLString() * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.ignoreComments, ignoreComments **/ public native static function get ignoreComments():Boolean; public native static function set ignoreComments(newIgnore:Boolean):void; /** * Determines whether XML * processing instructions are ignored when XML objects parse the source XML data. * By default, the processing instructions are ignored (true). To include XML * processing instructions, set this property to false. The * ignoreProcessingInstructions property is used only during the XML parsing, * not during the call to any method such as myXMLObject.child(~~).toXMLString(). * If the source XML includes processing instructions nodes, they are kept or discarded during * the XML parsing. * * @includeExample examples\XML.ignoreProcessingInstructions.1.as -noswf * * @see XML#child() * @see XML#toXMLString() * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.ignoreProcessingInstructions, ignoreProcessingInstructions **/ public native static function get ignoreProcessingInstructions():Boolean; public native static function set ignoreProcessingInstructions(newIgnore:Boolean):void; /** * Determines whether white space characters * at the beginning and end of text nodes are ignored during parsing. By default, * white space is ignored (true). If a text node is 100% white space and the * ignoreWhitespace property is set to true, then the node is not created. * To show white space in a text node, set the ignoreWhitespace property to * false. * * @includeExample examples\XML.ignoreWhitespace.1.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.ignoreWhitespace, ignoreWhitespace **/ public native static function get ignoreWhitespace():Boolean; public native static function set ignoreWhitespace(newIgnore:Boolean):void; /** * Determines whether the toString() * and toXMLString() methods normalize white space characters between some tags. * The default value is true. * * @includeExample examples\XML.prettyPrinting.1.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @see #prettyIndent * @see #toString() * @see #toXMLString() * @keyword XML, XML.prettyPrinting, prettyPrinting **/ public native static function get prettyPrinting():Boolean; public native static function set prettyPrinting(newPretty:Boolean):void; /** * Determines the amount of indentation applied by * the toString() and toXMLString() methods when * the XML.prettyPrinting property is set to true. * Indentation is applied with the space character, not the tab character. * * The default value is 2. * * @includeExample examples\XML.prettyIndent.1.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @see #prettyPrinting * @see #toString() * @see #toXMLString() * @keyword XML, XML.prettyIndent, prettyIndent **/ public native static function get prettyIndent():int; public native static function set prettyIndent(newIndent:int):void; } } package { // // XMLList // // Based on the ECMA E4X Specification, 1st Edition. /** * An XMLList object is an ordered collection of properties. An XMLList object represents an * XML document, an XML fragment, or an arbitrary collection of XML objects. * *

An XMLList object with one XML element is treated the same as an XML object. * When there is one XML element, all methods that are available * for the XML object are also available for the XMLList object.

* *

In the following example, example.two is an XMLList object of length 1, * so you can call any XML method on it.

* var example2 = <example><two>2</two></example>; * *

The following table lists the XML methods that are not included in the XMLList class, but * that you can use when your XMLList object has only one XML element. If you attempt to use these * methods with anything other than one XML element (zero or more than one * element), an exception is thrown.

* * * * * * * * * * * * * * * * * * * * * *
XML methods
addNamespace()
appendChild()
childIndex()
inScopeNamespace()
insertChildAFter()
insertChildBefore()
name()
namespace()
localName()
namespaceDeclarations()
nodeKind()
prependChild()
removeNamespace()
replace()
setChildren()
setLocalName()
setName()
setNamespace()
* *

This class (along with the XML, Namespace, and QName classes) implements powerful XML-handling * standards defined in ECMAScript for XML (E4X) specification (ECMA-357 edition 2).

* * @includeExample examples\XMLListExample.as -noswf * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XMLList * @see XML * @see Namespace * @see QName */ public final dynamic class XMLList { /** * Creates a new XMLList object. * * @param value Any object that can be converted to an XMLList object by using the top-level XMLList() function. * * @return If no arguments are included, the constructor returns an empty XMLList. If an XMLList object is included as * the parameter, the constructor returns a shallow copy of the XMLList object. If the parameter is an object of a type * other than XMLList, the constructor converts the object to an XMLList object and returns that object. * * @see global#XMLList() top-level XMLList() function * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XMLList **/ public native function XMLList (value:Object); /** * Calls the attribute() method of each XML object and returns an XMLList object * of the results. The results match the given attributeName parameter. If there is no * match, the attribute() method returns an empty XMLList object. * * @param attributeName The name of the attribute that you want to include in an XMLList object. * * @return An XMLList object of matching XML objects or an empty XMLList object. * * @see XML#attribute() * @see XML#attributes() * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XMLList, XMLList.attribute, attribute **/ public native function attribute (attributeName:* ):XMLList; /** * Calls the attributes() method of each XML object and * returns an XMLList object of attributes for each XML object. * * @return An XMLList object of attributes for each XML object. * * @see XML#attribute() * @see XML#attributes() * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XMLList, XMLList.attributes, attributes **/ public native function attributes ( ):XMLList; /** * Calls the child() method of each XML object and returns an XMLList object that * contains the results in order. * * @param propertyName The element name or integer of the XML child. * * @return An XMLList object of child nodes that match the input parameter. * * @see XML#child() * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XMLList, XMLList.child, child **/ public native function child ( propertyName:Object ):XMLList; /** * Calls the children() method of each XML object and * returns an XMLList object that contains the results. * * @return An XMLList object of the children in the XML objects. * * @oldexample The following sets a variable to an XMLList of children of all the items in the catalog XMLList: * *

var allitemchildren:XMLList = catalog.item.children();

* @oldexample The following sets a variable to an XMLList of all grandchildren of all the items in the catalog XMLList that * have the name size: * *

var grandchildren:XMLList = catalog.item.children().size;

* * @see XML#children() * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XMLList, XMLList.children, children **/ public native function children ( ):XMLList; /** * Calls the comments() method of each XML object and returns * an XMLList of comments. * * @return An XMLList of the comments in the XML objects. * * @see XML#comments() * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XMLList, XMLList.comments, comments **/ public native function comments ( ):XMLList; /** * Checks whether the XMLList object contains an XML object that is equal to the given * value parameter. * * @param value An XML object to compare against the current XMLList object. * * @return If the XMLList contains the XML object declared in the value parameter, * then true; otherwise false. * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XMLList, XMLList.contains, contains **/ public native function contains ( value:XML ):Boolean; /** * Returns a copy of the given XMLList object. The copy is a duplicate of the entire tree of nodes. * The copied XML object has no parent and returns null if you attempt to call the parent() method. * * @return The copy of the XMLList object. * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XMLList, XMLList.copy, copy **/ public native function copy ( ):XMLList; /** * Returns all descendants (children, grandchildren, great-grandchildren, and so on) of the XML object * that have the given name parameter. The name parameter can be a * QName object, a String data type, or any other data type that is then converted to a String * data type. * *

To return all descendants, use * the asterisk (~~) parameter. If no parameter is passed, * the string "~~" is passed and returns all descendants of the XML object.

* * @return An XMLList object of the matching descendants (children, grandchildren, and so on) of the XML objects * in the original list. If there are no descendants, returns an empty XMLList object. * * @param name The name of the element to match. * * @see XML#descendants() * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XMLList, XMLList.descendants, descendants **/ public native function descendants (name:Object="*"):XMLList; /** * Calls the elements() method of each XML object. The name parameter is * passed to the descendants() method. If no parameter is passed, the string "~~" is passed to the * descendants() method. * * @param name The name of the elements to match. * * @return An XMLList object of the matching child elements of the XML objects. * * @see XML#elements() * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XMLList, XMLList.elements, elements **/ public native function elements (name:Object="*"):XMLList; /** * Checks for the property specified by p. * * @param p The property to match. * * @return If the parameter exists, then true; otherwise false. * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XMLList, XMLList.hasOwnProperty, hasOwnProperty **/ public native function hasOwnProperty(p:String):Boolean; /** * Checks whether the XMLList object contains complex content. An XMLList object is * considered to contain complex content if it is not empty and either of the following conditions is true: * * * * @return If the XMLList object contains complex content, then true; otherwise false. * * @see XML#hasComplexContent() * @see XML#hasSimpleContent() * @see #hasSimpleContent() * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XMLList, XMLList.hasComplexContent, hasComplexContent **/ public native function hasComplexContent( ):Boolean; /** * Checks whether the XMLList object contains simple content. An XMLList object is * considered to contain simple content if one or more of the following * conditions is true: * * * @return If the XMLList contains simple content, then true; otherwise false. * * @see XML#hasComplexContent() * @see XML#hasSimpleContent() * @see #hasComplexContent() * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XMLList, XMLList.hasSimpleContent, hasSimpleContent **/ public native function hasSimpleContent( ):Boolean; /** * Returns the number of properties in the XMLList object. * * @return The number of properties in the XMLList object. * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XMLList, XMLList.length, length **/ public native function length ( ):int; /** * Merges adjacent text nodes and eliminates empty text nodes for each * of the following: all text nodes in the XMLList, all the XML objects * contained in the XMLList, and the descendants of all the XML objects in * the XMLList. * * @return The normalized XMLList object. * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XMLList, XMLList.normalize, normalize **/ public native function normalize ( ):XMLList; /** * Returns the parent of the XMLList object if all items in the XMLList object have the same parent. * If the XMLList object has no parent or different parents, the method returns undefined. * * @return Returns the parent XML object. * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XMLList, XMLList.parent, parent **/ public native function parent ( ):Object; /** * If a name parameter is provided, lists all the children of the XMLList object that * contain processing instructions with that name. With no parameters, the method lists all the * children of the XMLList object that contain any processing instructions. * * @param name The name of the processing instructions to match. * * @return An XMLList object that contains the processing instructions for each XML object. * * @see XML#processingInstructions() * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XMLList, XMLList.processingInstructions, processingInstructions **/ public native function processingInstructions ( name:String = "*"):XMLList; /** * Checks whether the property p is in the set of properties that can be iterated in a for..in statement * applied to the XMLList object. This is true only if toNumber(p) is greater than or equal to 0 * and less than the length of the XMLList object. * * @param p The index of a property to check. * * @return If the property can be iterated in a for..in statement, then true; otherwise false. * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XMLList, XMLList.propertyIsEnumerable, propertyIsEnumerable **/ public native function propertyIsEnumerable ( p:String ):Boolean; /** * Calls the text() method of each XML * object and returns an XMLList object that contains the results. * * @return An XMLList object of all XML properties of the XMLList object that represent XML text nodes. * * @see XML#text() * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XMLList, XMLList.text, text **/ public native function text ( ):XMLList; /** * Returns a string representation of all the XML objects in an XMLList object. The rules for * this conversion depend on whether the XML object has simple content or complex content: * * * * * *

To return the entire XML object every time, use the toXMLString() method.

* * * @return The string representation of the XML object. * * @includeExample examples\XMLToStringExample1.as -noswf * @includeExample examples\XMLToStringExample2.as -noswf * * @see XMLList#hasSimpleContent() * @see XMLList#hasComplexContent() * @see XMLList#toXMLString() * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.toString, toString * **/ public native function toString( ):String; /** * Returns a string representation of all the XML objects in an XMLList object. * Unlike the toString() method, the toXMLString() * method always returns the start tag, attributes, * and end tag of the XML object, regardless of whether the XML object has simple content * or complex content. (The toString() method strips out these items for XML * objects that contain simple content.) * * * @return The string representation of the XML object. * * @see XMLList#toString() * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XML, XML.toXMLString, toXMLString **/ public native function toXMLString( ):String; /** * Returns the XMLList object. * * @return Returns the current XMLList object. * * @playerversion Flash 9 * @langversion 3.0 * @helpid * @refpath * @keyword XMLList, XMLList.valueOf, valueOf **/ public native function valueOf( ):XMLList; } }