Guida di riferimento di ActionScript® 3.0 per la piattaforma Adobe® Flash®
Home  |  Nascondi elenco pacchetti e classi |  Pacchetti  |  Classi  |  Novità  |  Indice  |  Appendici  |  Perché in inglese?
Filtri: Recupero dati dal server...
Recupero dati dal server...
mx.collections 

ArrayList  - AS3 Flex

Pacchettomx.collections
Classepublic class ArrayList
EreditarietàArrayList Inheritance EventDispatcher Inheritance Object
Implementa IList, IExternalizable, IPropertyChangeNotifier
Sottoclassi Conflicts

Versione linguaggio: ActionScript 3.0
Versione prodotto: Flex 4
Versioni runtime: Flash Player 10, AIR 1.5

The ArrayList class is a simple implementation of IList that uses a backing Array as the source of the data. Items in the backing Array can be accessed and manipulated using the methods and properties of the IList interface. Operations on an ArrayList instance modify the data source; for example, if you use the removeItemAt() method on an ArrayList, you remove the item from the underlying Array. This base class will not throw ItemPendingErrors but it is possible that a subclass might.
  <mx:ArrayList
  Properties
  source="null"
  />
  

Proprietà MXML predefinitasource



Proprietà pubbliche
 ProprietàDefinito da
 Inheritedconstructor : Object
Un riferimento all'oggetto classe o alla funzione di costruzione per una determinata istanza di oggetto.
Object
  length : int
[sola lettura] Get the number of items in the list.
ArrayList
  source : Array
The source array for this ArrayList.
ArrayList
  uid : String
Provides access to the unique id for this list.
ArrayList
Metodi pubblici
 MetodoDefinito da
  
ArrayList(source:Array = null)
Construct a new ArrayList using the specified array as its source.
ArrayList
  
addAll(addList:IList):void
Adds a list of items to the current list, placing them at the end of the list in the order they are passed.
ArrayList
  
addAllAt(addList:IList, index:int):void
Adds a list of items to the current list, placing them at the position index passed in to the function.
ArrayList
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registra un oggetto listener di eventi con un oggetto EventDispatcher, in modo che il listener riceva la notifica di un evento.
EventDispatcher
  
Add the specified item to the end of the list.
ArrayList
  
addItemAt(item:Object, index:int):void
Add the item at the specified index.
ArrayList
 Inherited
Invia un evento nel flusso di eventi.
EventDispatcher
  
getItemAt(index:int, prefetch:int = 0):Object
Get the item at the specified index.
ArrayList
  
Return the index of the item if it is in the list such that getItemAt(index) == item.
ArrayList
 Inherited
Verifica se per l'oggetto EventDispatcher sono presenti listener registrati per un tipo specifico di evento.
EventDispatcher
 Inherited
Indica se per un oggetto è definita una proprietà specifica.
Object
 Inherited
Indica se un'istanza della classe Object si trova nella catena di prototipi dell'oggetto specificato come parametro.
Object
  
itemUpdated(item:Object, property:Object = null, oldValue:Object = null, newValue:Object = null):void
Notify the view that an item has been updated.
ArrayList
 Inherited
Indica se la proprietà specificata esiste ed è enumerabile.
Object
  
Remove all items from the list.
ArrayList
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Rimuove un listener dall'oggetto EventDispatcher.
EventDispatcher
  
Removes the specified item from this list, should it exist.
ArrayList
  
Remove the item at the specified index and return it.
ArrayList
  
setItemAt(item:Object, index:int):Object
Place the item at the specified index.
ArrayList
 Inherited
Imposta la disponibilità di una proprietà dinamica per le operazioni cicliche.
Object
  
Return an Array that is populated in the same order as the IList implementation.
ArrayList
 Inherited
Restituisce la rappresentazione in formato stringa di questo oggetto, formattato in base alle convenzioni specifiche per le versioni localizzate.
Object
  
[override] Pretty prints the contents of this ArrayList to a string and returns it.
ArrayList
 Inherited
Restituisce il valore di base dell'oggetto specificato.
Object
 Inherited
Verifica se un listener di eventi è registrato con questo oggetto EventDispatcher o qualsiasi suo antenato per il tipo di evento specificato.
EventDispatcher
Metodi protetti
 MetodoDefinito da
  
Called when any of the contained items in the list dispatch an ObjectChange event.
ArrayList
  
If the item is an IEventDispatcher, watch it for updates.
ArrayList
  
If the item is an IEventDispatcher, stop watching it for updates.
ArrayList
Eventi
 Evento Riepilogo Definito da
 Inherited[evento di trasmissione] Inviato quando Flash Player o l'applicazione AIR ottiene lo stato di attivazione del sistema operativo ed entra nello stato attivo.EventDispatcher
  Dispatched when the IList has been updated in some way.ArrayList
 Inherited[evento di trasmissione] Inviato quando Flash Player o l'applicazione AIR perde l'attivazione del sistema operativo e sta entrando nello stato inattivo.EventDispatcher
Descrizione delle proprietà

length

proprietà
length:int  [sola lettura]

Versione linguaggio: ActionScript 3.0
Versione prodotto: Flex 3
Versioni runtime: Flash Player 9, AIR 1.1

Get the number of items in the list. An ArrayList should always know its length so it shouldn't return -1, though a subclass may override that behavior.

Questa proprietà può essere utilizzata come origine per l’associazione di dati. Quando questa proprietà viene modificata, invia l’evento collectionChange .



Implementazione
    public function get length():int

source

proprietà 
source:Array

Versione linguaggio: ActionScript 3.0
Versione prodotto: Flex 3
Versioni runtime: Flash Player 9, AIR 1.1

The source array for this ArrayList. Any changes done through the IList interface will be reflected in the source array. If no source array was supplied the ArrayList will create one internally. Changes made directly to the underlying Array (e.g., calling theList.source.pop() will not cause CollectionEvents to be dispatched.



Implementazione
    public function get source():Array
    public function set source(value:Array):void

uid

proprietà 
uid:String

Versione linguaggio: ActionScript 3.0
Versione prodotto: Flex 3
Versioni runtime: Flash Player 9, AIR 1.1

Provides access to the unique id for this list.



Implementazione
    public function get uid():String
    public function set uid(value:String):void
Descrizione della funzione di costruzione

ArrayList

()Funzione di costruzione
public function ArrayList(source:Array = null)

Versione linguaggio: ActionScript 3.0
Versione prodotto: Flex 3
Versioni runtime: Flash Player 9, AIR 1.1

Construct a new ArrayList using the specified array as its source. If no source is specified an empty array will be used.

Parametri
source:Array (default = null) — The Array to use as a source for the ArrayList.
Descrizione dei metodi

addAll

()metodo
public function addAll(addList:IList):void

Versione linguaggio: ActionScript 3.0
Versione prodotto: Flex 3
Versioni runtime: Flash Player 9, AIR 1.1

Adds a list of items to the current list, placing them at the end of the list in the order they are passed.

Parametri

addList:IList — The list of items to add to the current list

addAllAt

()metodo 
public function addAllAt(addList:IList, index:int):void

Versione linguaggio: ActionScript 3.0
Versione prodotto: Flex 3
Versioni runtime: Flash Player 9, AIR 1.1

Adds a list of items to the current list, placing them at the position index passed in to the function. The items are placed at the index location and placed in the order they are recieved.

Parametri

addList:IList — The list of items to add to the current list
 
index:int — The location of the current list to place the new items.

addItem

()metodo 
public function addItem(item:Object):void

Versione linguaggio: ActionScript 3.0
Versione prodotto: Flex 3
Versioni runtime: Flash Player 9, AIR 1.1

Add the specified item to the end of the list. Equivalent to addItemAt(item, length);

Parametri

item:Object — the item to add

addItemAt

()metodo 
public function addItemAt(item:Object, index:int):void

Versione linguaggio: ActionScript 3.0
Versione prodotto: Flex 3
Versioni runtime: Flash Player 9, AIR 1.1

Add the item at the specified index. Any item that was after this index is moved out by one.

Parametri

item:Object — the item to place at the index
 
index:int — the index at which to place the item


Genera
RangeError — if index is less than 0 or greater than the length

getItemAt

()metodo 
public function getItemAt(index:int, prefetch:int = 0):Object

Versione linguaggio: ActionScript 3.0
Versione prodotto: Flex 3
Versioni runtime: Flash Player 9, AIR 1.1

Get the item at the specified index.

Parametri

index:int — the index in the list from which to retrieve the item
 
prefetch:int (default = 0) — int indicating both the direction and amount of items to fetch during the request should the item not be local.

Restituisce
Object — the item at that index, null if there is none

Genera
Error — if the data for that index needs to be loaded from a remote location
 
RangeError — if the index < 0 or index >= length

getItemIndex

()metodo 
public function getItemIndex(item:Object):int

Versione linguaggio: ActionScript 3.0
Versione prodotto: Flex 3
Versioni runtime: Flash Player 9, AIR 1.1

Return the index of the item if it is in the list such that getItemAt(index) == item. Note that in this implementation the search is linear and is therefore O(n).

Parametri

item:Object — the item to find

Restituisce
int — the index of the item, -1 if the item is not in the list.

itemUpdated

()metodo 
public function itemUpdated(item:Object, property:Object = null, oldValue:Object = null, newValue:Object = null):void

Versione linguaggio: ActionScript 3.0
Versione prodotto: Flex 3
Versioni runtime: Flash Player 9, AIR 1.1

Notify the view that an item has been updated. This is useful if the contents of the view do not implement IEventDispatcher. If a property is specified the view may be able to optimize its notification mechanism. Otherwise it may choose to simply refresh the whole view.

Parametri

item:Object — The item within the view that was updated.
 
property:Object (default = null) — A String, QName, or int specifying the property that was updated.
 
oldValue:Object (default = null) — The old value of that property. (If property was null, this can be the old value of the item.)
 
newValue:Object (default = null) — The new value of that property. (If property was null, there's no need to specify this as the item is assumed to be the new value.)

Elementi API correlati

itemUpdateHandler

()metodo 
protected function itemUpdateHandler(event:PropertyChangeEvent):void

Versione linguaggio: ActionScript 3.0
Versione prodotto: Flex 3
Versioni runtime: Flash Player 9, AIR 1.1

Called when any of the contained items in the list dispatch an ObjectChange event. Wraps it in a CollectionEventKind.UPDATE object.

Parametri

event:PropertyChangeEvent — The event object for the ObjectChange event.

removeAll

()metodo 
public function removeAll():void

Versione linguaggio: ActionScript 3.0
Versione prodotto: Flex 3
Versioni runtime: Flash Player 9, AIR 1.1

Remove all items from the list.

removeItem

()metodo 
public function removeItem(item:Object):Boolean

Versione linguaggio: ActionScript 3.0
Versione prodotto: Flex 3
Versioni runtime: Flash Player 9, AIR 1.1

Removes the specified item from this list, should it exist.

Parametri

item:Object — Object reference to the item that should be removed.

Restituisce
Boolean — Boolean indicating if the item was removed.

removeItemAt

()metodo 
public function removeItemAt(index:int):Object

Versione linguaggio: ActionScript 3.0
Versione prodotto: Flex 3
Versioni runtime: Flash Player 9, AIR 1.1

Remove the item at the specified index and return it. Any items that were after this index are now one index earlier.

Parametri

index:int — The index from which to remove the item.

Restituisce
Object — The item that was removed.

Genera
RangeError — if index < 0 or index >= length.

setItemAt

()metodo 
public function setItemAt(item:Object, index:int):Object

Versione linguaggio: ActionScript 3.0
Versione prodotto: Flex 3
Versioni runtime: Flash Player 9, AIR 1.1

Place 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.

Parametri

item:Object — the new value for the index
 
index:int — the index at which to place the item

Restituisce
Object — the item that was replaced, null if none

Genera
RangeError — if index is less than 0 or greater than or equal to length

startTrackUpdates

()metodo 
protected function startTrackUpdates(item:Object):void

Versione linguaggio: ActionScript 3.0
Versione prodotto: Flex 3
Versioni runtime: Flash Player 9, AIR 1.1

If the item is an IEventDispatcher, watch it for updates. This method is called by the addItemAt() method, and when the source is initially assigned.

Parametri

item:Object — The item passed to the addItemAt() method.

stopTrackUpdates

()metodo 
protected function stopTrackUpdates(item:Object):void

Versione linguaggio: ActionScript 3.0
Versione prodotto: Flex 3
Versioni runtime: Flash Player 9, AIR 1.1

If the item is an IEventDispatcher, stop watching it for updates. This method is called by the removeItemAt() and removeAll() methods, and before a new source is assigned.

Parametri

item:Object — The item passed to the removeItemAt() method.

toArray

()metodo 
public function toArray():Array

Versione linguaggio: ActionScript 3.0
Versione prodotto: Flex 3
Versioni runtime: Flash Player 9, AIR 1.1

Return an Array that is populated in the same order as the IList implementation.

Restituisce
Array — An Array populated in the same order as the IList implementation.

Genera
Error — if the data is not yet completely loaded from a remote location

toString

()metodo 
override public function toString():String

Versione linguaggio: ActionScript 3.0
Versione prodotto: Flex 3
Versioni runtime: Flash Player 9, AIR 1.1

Pretty prints the contents of this ArrayList to a string and returns it.

Restituisce
String — A String containing the contents of the ArrayList.
Descrizione degli eventi

collectionChange

Evento
Tipo di oggetto evento: mx.events.CollectionEvent
proprietà CollectionEvent.type = mx.events.CollectionEvent.COLLECTION_CHANGE

Versione linguaggio: ActionScript 3.0
Versione prodotto: Flex 3
Versioni runtime: Flash Player 9, AIR 1.1

Dispatched when the IList has been updated in some way.

The CollectionEvent.COLLECTION_CHANGE constant defines the value of the type property of the event object for an event that is dispatched when a collection has changed.

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.

PropertyValue
bubblesfalse
cancelablefalse
currentTargetThe Object that defines the event listener that handles the event. For example, if you use myButton.addEventListener() to register an event listener, myButton is the value of the currentTarget.
itemsAn Array of objects with information about the items affected by the event. The contents of this field depend on the event kind; for details see the items property
kindThe kind of event. The valid values are defined in the CollectionEventKind class as constants.
locationLocation within the target collection of the item(s) specified in the items property.
oldLocationthe previous location in the collection of the item specified in the items property.
targetThe Object that dispatched the event; it is not always the Object listening for the event. Use the currentTarget property to always access the Object listening for the event.
typeCollectionEvent.COLLECTION_CHANGE




[ X ]Perché in inglese?
Il contenuto della Guida di riferimento di ActionScript 3.0 appare in inglese

Non tutte le parti della Guida di riferimento di ActionScript 3.0 sono tradotte in tutte le lingue. Quando un elemento del linguaggio non è tradotto, viene riportato in inglese. Ad esempio, la classe ga.controls.HelpBox non è tradotta in nessuna lingua. Pertanto, nella versione italiana della guida di riferimento, la descrizione della classe ga.controls.HelpBox è riportata in inglese.