パッケージmx.collections
public class ArrayCollection
継承ArrayCollection Inheritance ListCollectionView Inheritance Proxy Inheritance Object
実装IExternalizable

ArrayCollection クラスは、ICollectionView または IList インターフェイスのメソッドとプロパティを使用して、アクセスおよび操作できるコレクションとして配列を公開するラッパークラスです。ArrayCollection インスタンスに対する操作はデータソースを変更します。たとえば、ArrayCollection で removeItemAt() メソッドを使用した場合、元になる Array からアイテムが削除されます。

MXML シンタックスexpandedMXML シンタックスの非表示

<mx:ArrayCollection> タグはスーパークラスのすべての属性を継承し、次の属性を追加します。

 <mx:ArrayCollection プロパティ source="null" /> 

デフォルトの MXML プロパティsource



次のコードを使用すると、単一のオブジェクトエレメントを持つ配列にアクセスし、この配列を操作する単純な ArrayCollection オブジェクトが作成されます。このコードは、IList インターフェイスの getItemAt メソッド、およびこのコードが ICollectionView の createCursor メソッドを使用して取得する IViewCursor オブジェクトを使用してエレメントを取得します。
var myCollection:ArrayCollection = new ArrayCollection([{first:'Matt', last:'Matthews'}]);
var myCursor:IViewCursor = myCollection.createCursor();
var firstItem:Object = myCollection.getItemAt(z0);
var firstItemFromCursor:Object = myCursor.current;
if (firstItem == firstItemFromCursor) {
//doCelebration();
  }
  

関連項目

データプロバイダおよびコレクションの使用


パブリックプロパティ
 プロパティ定義
 Inheritedconstructor : Object
特定のオブジェクトインスタンスのクラスオブジェクトまたはコンストラクタ関数への参照です。
Object
 InheritedfilterFunction : Function
関数の条件に一致しないアイテムを削除するためにビューが使用する関数です。
ListCollectionView
 Inheritedlength : int
このビュー内のアイテムの数です。
ListCollectionView
 Inheritedlist : IList
このコレクションビューが囲む IList です。
ListCollectionView
 Inheritedprototype : Object
[static] クラスまたは関数オブジェクトのプロトタイプオブジェクトへの参照です。
Object
 Inheritedsort : Sort
ICollectionView に適用されるソートです。
ListCollectionView
  source : Array
ArrayCollection 内のデータのソースです。
ArrayCollection
Protectedプロパティ
 プロパティ定義
 InheritedlocalIndex : Array
ビューにソートまたはフィルタを適用すると、そのビュー (ソートによりアイテムの順序が変更されたか、またはフィルタによりアイテム数が減ったビュー) に含まれているアイテムの配列が localIndex プロパティにソート順に格納されます。
ListCollectionView
パブリックメソッド
 メソッド定義
  ArrayCollection(source:Array = null)
コンストラクタ。
ArrayCollection
 InheritedaddEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
イベントリスナーオブジェクトを EventDispatcher オブジェクトに登録し、リスナーがイベントの通知を受け取るようにします。
ListCollectionView
 InheritedaddItem(item:Object):void
指定されたアイテムをリストの末尾に追加します。
ListCollectionView
 InheritedaddItemAt(item:Object, index:int):void
指定されたインデックス位置にアイテムを追加します。
ListCollectionView
 Inheritedcontains(item:Object):Boolean
ビューに指定されたオブジェクトを含めるかどうかを返します。
ListCollectionView
 InheritedcreateCursor():IViewCursor
このビューに対して使用する新しい IViewCursor を作成します。
ListCollectionView
 InheriteddisableAutoUpdate():void
コレクション自体およびコレクション内のアイテムの変更がビューから送出されないようにします。
ListCollectionView
 InheriteddispatchEvent(event:Event):Boolean
イベントをイベントフローに送出します。
ListCollectionView
 InheritedenableAutoUpdate():void
自動更新を有効にします。
ListCollectionView
 InheritedgetItemAt(index:int, prefetch:int = 0):Object
指定されたインデックス位置にあるアイテムを取得します。
ListCollectionView
 InheritedgetItemIndex(item:Object):int
アイテムがリスト内にあり、getItemAt(index) == アイテムになるような場合は、アイテムのインデックスを返します。
ListCollectionView
 InheritedhasEventListener(type:String):Boolean
EventDispatcher オブジェクトに、特定のイベントタイプに対して登録されたリスナーがあるかどうかを確認します。
ListCollectionView
 InheritedhasOwnProperty(name:String):Boolean
オブジェクトに指定されたプロパティが定義されているかどうかを示します。
Object
 Inheritedinitialized(document:Object, id:String):void
MXML タグを使用して ListCollectionView を作成したときに、MXML コンパイラによって自動的に呼び出されます。
ListCollectionView
 InheritedisPrototypeOf(theClass:Object):Boolean
Object クラスのインスタンスが、パラメータとして指定されたオブジェクトのプロトタイプチェーン内にあるかどうかを示します。
Object
 InheriteditemUpdated(item:Object, property:Object = null, oldValue:Object = null, newValue:Object = null):void
アイテムが更新されたビューを通知します。
ListCollectionView
 InheritedpropertyIsEnumerable(name:String):Boolean
指定されたプロパティが存在し、列挙可能かどうかを示します。
Object
 Inheritedrefresh():Boolean
ビューにソートとフィルタを適用します。
ListCollectionView
 InheritedremoveAll():void
リストからすべてのアイテムを削除します。
ListCollectionView
 InheritedremoveEventListener(type:String, listener:Function, useCapture:Boolean = false):void
EventDispatcher オブジェクトからリスナーを削除します。
ListCollectionView
 InheritedremoveItemAt(index:int):Object
指定されたインデックス位置にあるアイテムを削除し、返します。
ListCollectionView
 InheritedsetItemAt(item:Object, index:int):Object
指定されたインデックス位置にアイテムを配置します。
ListCollectionView
 InheritedsetPropertyIsEnumerable(name:String, isEnum:Boolean = true):void
ループ処理に対するダイナミックプロパティの可用性を設定します。
Object
 InheritedtoArray():Array
IList 実装と同じ順で指定された配列を返します。
ListCollectionView
 InheritedtoString():String
このビューの内容をストリングにプリティプリントし、返します。
ListCollectionView
 InheritedvalueOf():Object
指定されたオブジェクトのプリミティブ値を返します。
Object
 InheritedwillTrigger(type:String):Boolean
指定されたイベントタイプについて、この EventDispatcher オブジェクトまたはその祖先にイベントリスナーが登録されているかどうかを確認します。
ListCollectionView
Protectedメソッド
 メソッド定義
 InheritedcallProperty(name:*, ... rest):*
関数として呼び出し可能なオブジェクトプロパティの動作を上書きします。
Proxy
 InheriteddeleteProperty(name:*):Boolean
プロパティを削除する要求を上書きします。
Proxy
 InheritedgetDescendants(name:*):*
descendant 演算子の使用をオーバーライドします。
Proxy
 InheritedgetProperty(name:*):*
プロパティの値に対する要求を上書きします。
Proxy
 InheritedhasProperty(name:*):Boolean
オブジェクトが特定のプロパティを持っているかどうかを名前ごとにチェックする要求を上書きします。
Proxy
 InheritedisAttribute(name:*):Boolean
指定された QName が属性としてマークされているかどうかを確認します。
Proxy
 InheritednextName(index:int):String
インデックス番号を使用して、プロキシになるオブジェクトのプロパティを列挙してプロパティ名を取得できます。
Proxy
 InheritednextNameIndex(index:int):int
インデックス番号を使用して、プロキシになるオブジェクトのプロパティを列挙できます。
Proxy
 InheritednextValue(index:int):*
インデックス番号を使用して、プロキシになるオブジェクトのプロパティを列挙してプロパティ値を取得できます。
Proxy
 InheritedsetProperty(name:*, value:*):void
プロパティの値を変更する呼び出しを上書きします。
Proxy
イベント
 イベント一覧定義
 InheritedcollectionChange ICollectionView が何らかの方法で更新されると送出されます。ListCollectionView
プロパティの詳細
sourceプロパティ
source:Array  [read-write]

ArrayCollection 内のデータのソースです。ArrayCollection オブジェクトは、ソース配列に直接加えた変更を表しません。コレクションを変更するには、常に ICollectionView メソッドまたは IList メソッドを使用します。

このプロパティはデータバインディングのソースとして使用できます。

実装
    public function get source():Array
    public function set source(value:Array):void
コンストラクタの詳細
ArrayCollection()コンストラクタ
public 関数 ArrayCollection(source:Array = null)

コンストラクタ。

指定されたソース配列を使用して新しい ArrayCollection を作成します。配列が指定されていない場合は、空の配列が使用されます。

パラメータ
source:Array (default = null)




 

このページに新しいコメントが追加された場合に、電子メールでの通知を希望する。 | コメントレポート

現在のページ: http://livedocs.adobe.com/flex/2_jp/langref/mx/collections/ArrayCollection.html