ArrayCollection is a wrapper class around Array, and underlying Array can be access using source property
The ArrayCollection class is a wrapper class that exposes an Array as
a collection that can be accessed and manipulated using the methods
and properties of the ICollectionView or IList interfaces. Operations
on a ArrayCollection instance modify the data source; for xample, if
you use the removeItemAt() method on an ArrayCollection, you remove
the item from the underlying Array.
- so one should always use Source property of ArrayCollection, if have populated Array
i suggest to declare b as Array not as ArrayCollection and initialize a as
a = new ArrayCollection(b); or
a= new ArrayCollection();// Default constructor ArrayCollection(source:Array=null);
a.source = b; //updates data in Arraycollection
Data Binding means bound controls with datasource(could be any thing like functions, objects, other control, Array, XML, Collection, List etc)
Data binding is the process of tying the data in one object to another
object. It provides a convenient way to pass data between the
different layers of the application. Data binding requires a source
property, a destination property, and a triggering event that
indicates when to copy the data from the source to the destination. An
object dispatches the triggering event when the source property
changes.
- Data Binding could be harmful for application with large data because it would creates multiple changes events and both getter and setter executes on change, which need extra proccessing so it would be good practice to shorter scope of a and provide data directly to source as
private function handler_B_DataChange(event:Event)
{
var a:Arraycollection = new ArrayCollection(b);
controlA.dataProvider = a;
//or just
controlB.dataProvider = new ArrayCollection(b);
}
Details of binding could be view on Binding to functions, Objects, and Arrays
Hopes that Helps