Le damos el enfoque correcto a tus sistemas. La Experiencia de Vivir sin Problemas. Servidores Cloud en Azure. Proyectos Office Centralita Virtual en Nube. Clientes satisfechos. Reuniones de equipo. Correos Contestados. Carrer de la Riereta, 37, esc. A , Ripollet, Barcelona. Carrer de Jaume I 6B Entlo. Pasaje San Miguel 26, Executes a test function on each item in the array until an item is reached that returns true.
Use this method to determine whether any items in an array meet a criterion, such as having a value less than a particular number. Sorts the elements in an array.
This method sorts according to Unicode values. By default, Array. 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 sortOptions portion of the If you create a custom function, you call the sort method, and use the name of your custom function as the first argument compareFunction.
This method uses the syntax and argument order Array. Note: The default behavior of the sort function is to handle each entity as a string. If you use the Array. If it fails, the runtime throws an error. For example, the runtime can successfully convert a String value of "6" to an integer, but will throw an error if it encounters a String value of "six". Sorts the elements in an array according to one or more fields in the array.
The array should have the following characteristics: The array is an indexed array, not an associative array. Each element of the array holds an object with one or more properties. All of the objects have at least one property in common, the values of which can be used to sort the array. Such a property is called a field. 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. 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.
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. 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 and later, 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:.
Note: The fieldName and options arrays must have the same number of elements; otherwise, the options array is ignored. Also, the Array. Parameters fieldName : Object — 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.
The following values are acceptable for the options parameter: Array. Adds elements to and removes elements from an array.
Note: To override this method in a subclass of Array, use Parameters startIndex : int — An integer that specifies the index of the element in the array where the insertion or deletion begins. This number includes the element specified in the startIndex parameter.
If you do not specify a value 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. If an inserted value is of type Array, the array is kept intact and inserted as a single element. For example, if you splice an existing array of length three with another array of length three, the resulting array will have only four elements.
One of the elements, however, will be an array of length three. Returns a string that represents the elements in the specified array. 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. To specify a custom separator, use the Array.
Adds one or more elements to the beginning of an array and returns the new length of the 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. Specifies descending sorting for the Array class sorting methods.
The value of this constant is 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. This constant applies only to numbers in the array; it does not apply to strings that contain numeric data such as ["23", "5"].
Specifies that a sort returns an array that consists of array indices. You can use this constant for the options parameter in the sort or sortOn method, so you have access to multiple views of the array elements while the original array is unmodified. The value of this constant is 8. Specifies the unique sorting requirement for the Array class sorting methods. 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. Filters: Retrieving Data from Server Retrieving Data from Server Classes x.
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. In addition, you can use the array access [] operator to initialize an array or access the elements of an array. When you assign one array variable to another array variable, both refer to the same array: Copy.
Creating arrays Inserting array elements Retrieving values and removing array elements Sorting an array Querying an array Extending the Array class Arrays example: PlayList. Working with arrays Basics of arrays Indexed arrays Associative arrays Multidimensional arrays Cloning arrays.
Public Properties. Hide Inherited Public Properties. Show Inherited Public Properties. A reference to the class object or constructor function for a given object instance. Public Methods. Hide Inherited Public Methods. Show Inherited Public Methods. Indicates whether an object has a specified property defined. Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Removes the last element from an array and returns the value of that element. Indicates whether the specified property exists and is enumerable.
Adds one or more elements to the end of an array and returns the new length of the array. Sets the availability of a dynamic property for loop operations. Public Constants. Property Detail. Implementation public function get length : uint public function set length value: uint : void Example How to use this example The following code creates an Array object names with the string element Bill. It then uses the push method to add another string element Kyle.
The length of the array, as determined by the length property, was one element before the use of push and is two elements after push is called. Another string, Jeff , is added to make the length of names three elements. The shift method is then called twice to remove Bill and Kyle , making the final array of length one.
Throws RangeError — The argument is a number that is not an integer greater than or equal to 0. More examples Creating an Array instance.
The following example creates a new Array object with an initial length of 3, populates the array with the string elements one , two , and three , and then converts the elements to a string. The following example creates the Array object myArr with no arguments and an initial length of 0: Copy. The following example creates an Array object with 5 initial elements, with a length of 5, and populates the first element with the string "one" , and adds the string element "six" to the end of the array by using the push method: Copy.
AS3 function concat Returns Array — An array that contains the elements from this array followed by elements from the parameters.
More examples Querying an array. The following code creates four Array objects: The numbers array, which contains the numbers 1 , 2 , and 3. The letters array, which contains the letters a , b , and c. The numbersAndLetters array, which calls the concat method to produce the array [1,2,3,a,b,c].
The lettersAndNumbers array, which calls the concat method to produce the array [a,b,c,1,2,3]. Returns Boolean — A Boolean value of true if all items in the array return true for the specified function; otherwise, false. The following example tests two arrays to determine whether every item in each array is a number.
It also outputs the results of the test, showing that isNumeric is true for the first array and false for the second: Copy. Returns Array — A new array that contains all items from the original array that returned true. The following example creates an array of all employees who are managers: Copy. Example How to use this example The following example runs the trace statement in the traceEmployee function on each item in the array: Copy.
The following example also runs the trace statement in a slightly altered traceEmployee function on each item in the array: Copy. Returns int — A zero-based index position of the item in the array. If the searchElement argument is not found, the return value is The following example displays the position of the specified array: Copy. Returns String — A string consisting of the elements of an array converted to strings and separated by the specified parameter.
The following code creates an Array object myArr with elements one , two , and three and then a string containing one and two and three using the join method. The following code creates an Array object specialChars with elements , , - , and a blank space and then creates a string containing Then, using a for loop, it removes each type of special character listed in specialChars to produce a string myStr that contains only the digits of the phone number remaining: Returns Array — A new array that contains the results of the function on each item in the original array.
The following example changes all items in the array to use uppercase letters: Copy. More examples Retrieving values and removing array elements. The following code creates an Array object letters with elements a , b , and c. The last element c is then removed from the array using the pop method and assigned to the String object letter. AS3 function push Returns uint — An integer representing the length of the new array.
More examples Inserting array elements. The following code creates an empty Array object letters and then populates the array with the elements a , b , and c using the push method. The following code creates an Array object letters , which is initially populated with the element a. The push method is then used once to add the elements b and c to the end of the array, which is three elements after the push.
Returns Array — The new array. More examples Sorting an array. The order of the array elements is then reversed using the reverse method to produce the array [c,b,a]. The following code creates the Array object letters with elements a , b , and c. The shift method is then used to remove the first element a from letters and assign it to the string firstLetter. Returns Array — An array that consists of a range of elements from the original array. The following code creates an Array object letters with elements [a,b,c,d,e,f].
The array someLetters is then created by calling the slice method on elements one b through three d , resulting in an array with elements b and c. The array someLetters is then created by calling the slice method on element two c , resulting in an array with elements [c,d,e,f].
The array someLetters is then created by calling the slice method on the second to last element from the end e , resulting in an array with elements e and f. Returns Boolean — A Boolean value of true if any items in the array return true for the specified function; otherwise false.
Related API Elements every.
0コメント