1 Reply Latest reply on Aug 17, 2009 3:29 PM by Flex harUI

    applicationComplete calling 2 different methods.

    karnatis Level 1

      Hi All,

       

        Declared applicationComplete in below way:

       

      <mx:Application

       

       

       

      xmlns:mx="http://www.adobe.com/2006/mxml" applicationComplete="ro.getStateCodes()">

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

      <mx:Script>

       

       

       

       

       

       

      import mx.rpc.events.ResultEvent;

       

       

       

       

       

      import mx.rpc.events.FaultEvent;

       

       

       

       

       

      import mx.controls.Alert;

       

       

       

       

       

      import mx.utils.ArrayUtil;

       

       

       

       

       

      import mx.collections.ArrayCollection;

       

       

       

       

       

      import mx.utils.StringUtil;

       

       

       

       

       

       

      public function faultHandler(event:FaultEvent):void

      {

            Alert.show(event.fault.faultString,

      "Error");

      }

       

       

       

       

       

       

       

      private function result(e:ResultEvent):void

      {

       

       

       

       

       

          //state.dataProvider = e.result as ArrayCollection;

       

       

       

       

       

       

       

       

       

       

       

       

          combobox.dataProvider = e.result

      as ArrayCollection;

       

      }

       

       

       

       

       

       

       

       

       

      </mx:Script>

       

       

       

       

       

       

      <mx:RemoteObject id="ro" result="result(event)" destination="HelloWorld" fault="faultHandler(event)"/>

       

       

       

       

       

       

       

      <mx:ComboBox id= "combobox" />

       

       

       

       

      <!--

      <mx:DataGrid id="state" width="100%">

      <mx:columns>

      <mx:DataGridColumn dataField="code" headerText="Code"/>

      <mx:DataGridColumn dataField="name" headerText="Name"/>

      </mx:columns>

      </mx:DataGrid>

       

      -->

       

       

         For displaying DataGrid I need to invoke another method in "HelloWorld" program. Say I need to call getState() method and need to uncomment

      //state.dataProvider = e.result as ArrayCollection;

       

      but the problem is how to call 2 different methods in applicationComplete at same time?? I need to invoke getState() to fill data for DataGrid and getStateCodes() for ComboBox.

       

        If I call these methods separetely it is working fine.

       

        Thanks in advance.

       

      Regards,

      Sharath.