Remote Object with Multiple Methods : RemoteObject « Development « Flex






Remote Object with Multiple Methods

Remote Object with Multiple Methods
         
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
  <mx:Script>
    
      import mx.collections.ArrayCollection;
      import mx.rpc.events.ResultEvent;
      
      [Bindable]
      private var statesData:ArrayCollection;
      [Bindable]
      private var helloString:String;
      
      private function arrayHandler(event:ResultEvent):void
      {
        statesData = event.result as ArrayCollection;
      }
      private function helloHandler(event:ResultEvent):void
      {
        helloString = event.result as String;
      }
  
  </mx:Script>
  
  <mx:RemoteObject id="myRemoteObject" destination="helloClass" result="arrayHandler(event)">
    <mx:method name="helloWorld" result="helloHandler(event)"/>
    <mx:method name="getArray" result="arrayHandler(event)"/>
  </mx:RemoteObject>
  
  <mx:Button label="Get String" click="myRemoteObject.helloWorld()"/>
  <mx:Label text="{helloString}" fontSize="14"/>
    
  <mx:Button label="Get Array" click="myRemoteObject.getArray()"/>
  <mx:DataGrid dataProvider="{statesData}"/>
  
</mx:Application>

   
    
    
    
    
    
    
    
    
  








Related examples in the same category

1.Feed returning value from RemoteObject to DataGridFeed returning value from RemoteObject to DataGrid
2.Calling RemoteObject components in ActionScript
3.Call remote method with RemoteObjectCall remote method with RemoteObject
4.Convert returning value from RemoteObject to ArrayCollectionConvert returning value from RemoteObject to ArrayCollection
5.Pass bounded parameters to RemoteObjectPass bounded parameters to RemoteObject
6.RemoteObject Result EventRemoteObject Result Event
7.RemoteObject With BindingsRemoteObject With Bindings
8.Remote Object Explicit ArgumentsRemote Object Explicit Arguments