Packageorg.igniterealtime.xiff.collections
Classpublic class ArrayCollection
InheritanceArrayCollection Inheritance flash.utils.Proxy
Implements ICollection
Subclasses Room, Roster

The ArrayCollection class is a wrapper class that exposes an Array as a collection that can be accessed and manipulated using collection methods.



Public Properties
 PropertyDefined By
  length : int
[read-only] The number of items in the ArrayCollection.
ArrayCollection
  source : Array
The source of data in the ArrayCollection.
ArrayCollection
Protected Properties
 PropertyDefined By
  eventDispatcher : EventDispatcher
ArrayCollection
  _source : Array
ArrayCollection
Public Methods
 MethodDefined By
  
ArrayCollection(source:Array = null)
Constructor.
ArrayCollection
  
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event.
ArrayCollection
  
addItem(item:*):void
Add the specified item to the end of the list.
ArrayCollection
  
addItemAt(item:*, index:int):void
Add the specified item at the specified index.
ArrayCollection
  
Remove all items from the ArrayCollection without dispatching a RESET event.
ArrayCollection
  
contains(item:*):Boolean
Returns whether the ArrayCollection contains the specified item.
ArrayCollection
  
dispatchEvent(event:Event):Boolean
Dispatches an event into the event flow.
ArrayCollection
  
getItemAt(index:int):*
Get the item at the specified index.
ArrayCollection
  
getItemIndex(item:*):int
Get the index of the item if it is in the ArrayCollection such that getItemAt( index ) == item.
ArrayCollection
  
hasEventListener(type:String):Boolean
Checks whether the EventDispatcher object has any listeners registered for a specific type of event.
ArrayCollection
  
itemUpdated(item:*):void
Notifies the view that an item has been updated.
ArrayCollection
  
removeAll():void
Remove all items from the ArrayCollection.
ArrayCollection
  
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object.
ArrayCollection
  
removeItem(item:*):Boolean
Remove the specified item from this list, should it exist.
ArrayCollection
  
removeItemAt(index:int):*
Removes the item at the specified index and returns it.
ArrayCollection
  
setItemAt(item:*, index:int):*
Places the item at the specified index.
ArrayCollection
  
toArray():Array
Return an Array that is populated in the same order as the ArrayCollection.
ArrayCollection
  
toString():String
Pretty prints the contents of the ArrayCollection to a string and returns it.
ArrayCollection
  
willTrigger(type:String):Boolean
Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type.
ArrayCollection
Protected Methods
 MethodDefined By
  
internalDispatchEvent(kind:String, item:* = null, location:int = -1):void
Dispatches a collection event with the specified information.
ArrayCollection
Protected Constants
 ConstantDefined By
  OUT_OF_BOUNDS_MESSAGE : String = The supplied index is out of bounds.
ArrayCollection
Property Detail
_sourceproperty
protected var _source:Array

eventDispatcherproperty 
protected var eventDispatcher:EventDispatcher

lengthproperty 
length:int  [read-only]

The number of items in the ArrayCollection.


Implementation
    public function get length():int
sourceproperty 
source:Array

The source of data in the ArrayCollection.


Implementation
    public function get source():Array
    public function set source(value:Array):void
Constructor Detail
ArrayCollection()Constructor
public function ArrayCollection(source:Array = null)

Constructor.

Parameters
source:Array (default = null)
Method Detail
addEventListener()method
public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void

Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event.

Parameters

type:String
 
listener:Function
 
useCapture:Boolean (default = false)
 
priority:int (default = 0)
 
useWeakReference:Boolean (default = false)

addItem()method 
public function addItem(item:*):void

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

Parameters

item:*

addItemAt()method 
public function addItemAt(item:*, index:int):void

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

Parameters

item:*
 
index:int

clearSource()method 
public function clearSource():void

Remove all items from the ArrayCollection without dispatching a RESET event.

contains()method 
public function contains(item:*):Boolean

Returns whether the ArrayCollection contains the specified item.

Parameters

item:*

Returns
Boolean
dispatchEvent()method 
public function dispatchEvent(event:Event):Boolean

Dispatches an event into the event flow.

Parameters

event:Event

Returns
Boolean
getItemAt()method 
public function getItemAt(index:int):*

Get the item at the specified index.

Parameters

index:int

Returns
*
getItemIndex()method 
public function getItemIndex(item:*):int

Get the index of the item if it is in the ArrayCollection such that getItemAt( index ) == item.

Parameters

item:*

Returns
int
hasEventListener()method 
public function hasEventListener(type:String):Boolean

Checks whether the EventDispatcher object has any listeners registered for a specific type of event.

Parameters

type:String

Returns
Boolean
internalDispatchEvent()method 
protected function internalDispatchEvent(kind:String, item:* = null, location:int = -1):void

Dispatches a collection event with the specified information.

Parameters

kind:String
 
item:* (default = null)
 
location:int (default = -1)

itemUpdated()method 
public function itemUpdated(item:*):void

Notifies the view that an item has been updated.

Parameters

item:*

removeAll()method 
public function removeAll():void

Remove all items from the ArrayCollection.

removeEventListener()method 
public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void

Removes a listener from the EventDispatcher object.

Parameters

type:String
 
listener:Function
 
useCapture:Boolean (default = false)

removeItem()method 
public function removeItem(item:*):Boolean

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

Parameters

item:*

Returns
Boolean
removeItemAt()method 
public function removeItemAt(index:int):*

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

Returns
*
setItemAt()method 
public function setItemAt(item:*, index:int):*

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:*
 
index:int

Returns
*
toArray()method 
public function toArray():Array

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

Returns
Array
toString()method 
public function toString():String

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

Returns
String
willTrigger()method 
public function willTrigger(type:String):Boolean

Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type.

Parameters

type:String

Returns
Boolean
Constant Detail
OUT_OF_BOUNDS_MESSAGEConstant
protected const OUT_OF_BOUNDS_MESSAGE:String = The supplied index is out of bounds.