1 Reply Latest reply on Mar 26, 2008 10:29 AM by Gaurav J

    How to get ArrayCollection length in initial function?

    mark416 Level 1
      Hi,

      I am working for conver Application form Flex 2 to Flex 3.

      I have the following code,I can see in the dataGrid and ArrayCollection length in the label "loopNumber",but why I can not get ArrayCollection length in initPage() for Flex 3 and the loop doesn't work.

      But I can get ArrayCollection length in initPage() in Flex 2.


      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" ... creationComplete="initPage()">
      >
      <mx:Script>
      <![CDATA[

      import ....;
      import ....;

      [Bindable]
      private var modelLocator:AdminModel = AdminModel.getInstance();

      private function initPage():void{

      Alert.show(modelLocator.acProcess.length.toString());

      for ( var j : int =0; j <modelLocator.acProcess.length ; j++)
      {
      ....

      }

      }
      ...
      ]]>
      </mx:Script>

      ...
      <mx:DataGrid x="42" y="64" id="proceeList" dataProvider="{modelLocator.acProcess}" width="300" updateComplete="initPage()">
      <mx:columns>
      <mx:DataGridColumn headerText="Bursary Online" dataField="processName"/>
      </mx:columns>
      </mx:DataGrid>
      ...

      <mx:Label id="loopNumber" x="32" y="428" text="{modelLocator.acProcess.length}"/>
      </Application>