Adobe arraycollection




















Returns whether the view contains the specified object. Unlike the IViewCursor. If the view has a filter applied to it this method may return false even if the underlying collection does contain the item. Parameters item : Object — The object to look for. Prevents changes to the collection itself and items within the collection from being dispatched by the view. Also prevents the view from updating the positions of items if the positions change in the collection.

The changes will be queued and dispatched appropriately after enableAutoUpdate is called. If more events than updates to a single item occur, the view may end up resetting. The disableAutoUpdate method acts cumulatively; the same number of calls to enableAutoUpdate are required for the view to dispatch events and refresh.

Note that disableAutoUpdate only affects the individual view; edits may be detected on an individual basis by other views. Dispatches an event into the event flow. The event target is the EventDispatcher object upon which dispatchEvent is called. Parameters event : Event — The event object dispatched into the event flow. Enables auto-updating. See disableAutoUpdate for more information. Parameters index : int — The index in the list from which to retrieve the item.

Note: unlike IViewCursor. Parameters item : Object — The item to find. Checks whether the EventDispatcher object has any listeners registered for a specific type of event.

This allows you to determine where an EventDispatcher object has altered handling of an event type in the event flow hierarchy. To determine whether a specific event type will actually trigger an event listener, use IEventDispatcher.

The difference between hasEventListener and willTrigger is that hasEventListener examines only the object to which it belongs, whereas willTrigger examines the entire event flow for the event specified by the type parameter. Notifies the view that an item has been updated. This method is useful if the contents of the view do not implement IPropertyChangeNotifier. If the call to this method includes a property parameter, the view may be able to optimize its notification mechanism.

Otherwise it may choose to simply refresh the whole view. Parameters item : Object — The item within the view that was updated.

If property was null, this can be the old value of the item. If property was null, there's no need to specify this as the item is assumed to be the new value. Applies the sort and filter to the view.

The ICollectionView does not detect changes to a sort or filter automatically, so you must call the refresh method to update the view after setting the sort or filterFunction property. Returns true if the refresh was successful and false if the sort is not yet complete e. Removes a listener from the EventDispatcher object. If there is no matching listener registered with the EventDispatcher object, a call to this method has no effect.

If the listener was registered for both the capture phase and the target and bubbling phases, two calls to removeEventListener are required to remove both: one call with useCapture set to true , and another call with useCapture set to false.

Removes the item at the specified index and returns it. Any items that were after this index are now one index earlier. Parameters index : int — The index from which to remove the item. Places the item at the specified index. If an item was already at that index the new item will replace it and it will be returned. Parameters item : Object — The new item to be placed at the specified index.

Returns an Array that is populated in the same order as the IList implementation. This method can throw an ItemPendingError. Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type.

This method returns true if an event listener is triggered during any phase of the event flow when an event of the specified type is dispatched to this EventDispatcher object or any of its descendants.

The properties of the event object have the following values. Not all properties are meaningful for all kinds of events. See the detailed property descriptions for more information. Filters: Retrieving Data from Server Retrieving Data from Server Classes x. Package mx. As a result, you can pass an object of this class to anything that requires an IList or ICollectionView. Public Properties. Protected Properties. Public Methods. 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.

This property can be used as the source for data binding. When this property is modified, it dispatches the listChanged event. Creates a new ArrayCollection using the specified source array. If no array is specified an empty array will be used. Filters: Retrieving Data from Server Retrieving Data from Server Classes x.

Package mx. Operations on a ArrayCollection instance modify the data source; for example, if you use the removeItemAt method on an ArrayCollection, you remove the item from the underlying Array. Setting a data provider in ActionScript Example: Updating an Array by using data view methods and properties.

About collections and data provider components Collection events and manual change notification Hierarchical data objects Data providers and the uid property. Public Properties. Hide Inherited Public Properties. Show Inherited Public Properties.



0コメント

  • 1000 / 1000