<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
creationComplete="init()">
This is my header, and this is the function that is being called by creationComplete:
protected function init():void
{
var mySort:Sort = new Sort();
mySort.fields = [new SortField('title')];
acCart.sort = mySort;
acCart.refresh();
}
Now, I’m adding some objects from one arraycollection (shop) to another (cart) basically (shown in a datagrid). The cart-datagrid is being modified everytime I press the button “add to cart”.
I thought that the creationcomplete-statement was only executed once, but now I’m in doubt, because it’s the only function that contains the refresh() and if I delete it, my cart isn’t updatet anymore. Can somebody provide me with some more information about the creationcomplete statement? A search on the internet and in my textbook hasn’t learned me what it exactly does.
Upon creation complete, your
acCartArrayCollection is sorted; however, components bound to that ArrayCollection should update upon adding objects to an ArrayCollection.ArrayCollection is a very heavy collection, dispatching events upon collection change.
Once bound to a DataGrid, alterations to the collection will be reflected within the DataGrid.
http://blog.flexdevelopers.com/2009/03/flex-basics-arraycollection.html
Creation Complete: