0 Replies Latest reply on Dec 18, 2010 1:48 AM by kiran7881

    flex 3 Remote Object-- help needed with event.result as ArrayCollection

    kiran7881 Level 1

      <?xml version="1.0" encoding="utf-8"?>

       

      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">

       

      <mx:Script>

       

        <![CDATA[

       

         import mx.rpc.events.FaultEvent;

       

         import mx.rpc.events.ResultEvent;

       

         import mx.collections.ArrayCollection;

       

            import mx.utils.ObjectProxy;

       

         import mx.controls.Alert;

       

       

       

            [Bindable]       

       

      var ac:ArrayCollection = new ArrayCollection();

       

       


      public function GetData():void
              {
                 
      some.getData();
              }
      public function displayDetails(event:ResultEvent):void
      {
                
                 if(event.result && event.result.list && event.result.list.user && event.result.list.user is ArrayCollection)
                 {
                     Alert.show("If ");

       

           ac = event.result.list.user as ArrayCollection

       

                 }

       


      else if (event.result && event.result.list && event.result.list.user && event.result.list.user is ObjectProxy){
           Alert.show("else If ");
           ac.addItem(event.result.list.user);

       

      }else{

       

      Alert.show("else ");

       

      }
                

        ]]>
      </mx:Script>
           <mx:RemoteObject id="some"
      destination="hello"
      fault="Alert.show(event.fault.faultString);"
      result="displayDetails(event)"
      />
                    <mx:Button label="GetData" click="GetData()"/>
          <mx:DataGrid  dataProvider="{ac}" x="131" y="222">
                      <mx:columns>
                          <mx:DataGridColumn headerText="UserName" dataField="name"/>
                          <mx:DataGridColumn headerText="Password" dataField="Employee.pass"/>
                      </mx:columns>
                  </mx:DataGrid>
      </mx:Application>

       

       

       

      Here the  any  Alert is not getting displayed at all . please help .