Packagecom.vmware.flexutil.events
Classpublic class MethodReturnEvent
InheritanceMethodReturnEvent Inheritance flash.events.Event

This class defines a generic method return event that can used by any class to notify its caller through a callback. Examples of its use include a proxy calling back at the completion of a remote method.

View the examples



Public Properties
 PropertyDefined By
  callContext : Object
[read-only] This property represents an arbitrary call context supplied by the caller to the callee when invoking the method whose completion is represented by this event.
MethodReturnEvent
  callee : Object
[read-only] The callee object is the target of the method invocation whose completion is represented by this event.
MethodReturnEvent
  error : Error
[read-only] The error resulting from the method invocation whose completion is represented by this event.
MethodReturnEvent
  result : Object
[read-only] The result or return value from the method invocation whose completion is represented by this event.
MethodReturnEvent
Public Methods
 MethodDefined By
  
MethodReturnEvent(result:Object, error:Error, callContext:Object = null, callee:Object = null, eventId:String)
Initializes a new instance of this class.
MethodReturnEvent
  
clone():Event
[override] Creates a clone of this event.
MethodReturnEvent
  
newErrorEvent(error:Error, callContext:Object = null, callee:Object = null):MethodReturnEvent
[static] A convenience factory method for this class that assumes null value for the result.
MethodReturnEvent
  
newResultEvent(result:Object, callContext:Object = null, callee:Object = null):MethodReturnEvent
[static] A convenience factory method for this class that assumes null value for the error.
MethodReturnEvent
Public Constants
 ConstantDefined By
  DEFAULT_RETURN_ID : String = methodReturn
[static] This string is used for the type property if no custom id is provided to the constructor.
MethodReturnEvent
Property Detail
callContextproperty
callContext:Object  [read-only]

This property represents an arbitrary call context supplied by the caller to the callee when invoking the method whose completion is represented by this event.


Implementation
    public function get callContext():Object
calleeproperty 
callee:Object  [read-only]

The callee object is the target of the method invocation whose completion is represented by this event.


Implementation
    public function get callee():Object
errorproperty 
error:Error  [read-only]

The error resulting from the method invocation whose completion is represented by this event.


Implementation
    public function get error():Error
resultproperty 
result:Object  [read-only]

The result or return value from the method invocation whose completion is represented by this event.


Implementation
    public function get result():Object
Constructor Detail
MethodReturnEvent()Constructor
public function MethodReturnEvent(result:Object, error:Error, callContext:Object = null, callee:Object = null, eventId:String)

Initializes a new instance of this class.

Parameters
result:Object — Value for the result property.
 
error:Error — Value for the error property.
 
callContext:Object (default = null) — Value for the callContext property.
 
callee:Object (default = null) — Value for the callee property.
 
eventId:String (default = NaN) — Value for the type property.
Method Detail
clone()method
override public function clone():Event

Creates a clone of this event. All custom events should override this method.

Returns
Event — A clone of this event.
newErrorEvent()method 
public static function newErrorEvent(error:Error, callContext:Object = null, callee:Object = null):MethodReturnEvent

A convenience factory method for this class that assumes null value for the result.

Parameters

error:Error — Value for the error property.
 
callContext:Object (default = null) — Value for the callContext property.
 
callee:Object (default = null) — Value for the callee property.

Returns
MethodReturnEvent
newResultEvent()method 
public static function newResultEvent(result:Object, callContext:Object = null, callee:Object = null):MethodReturnEvent

A convenience factory method for this class that assumes null value for the error.

Parameters

result:Object — Value for the result property.
 
callContext:Object (default = null) — Value for the callContext property.
 
callee:Object (default = null) — Value for the callee property.

Returns
MethodReturnEvent
Constant Detail
DEFAULT_RETURN_IDConstant
public static const DEFAULT_RETURN_ID:String = methodReturn

This string is used for the type property if no custom id is provided to the constructor.

Examples
Use of MethodReturnEvent in the GlobalView SDK sample:
   private function onButtonClick(click:MouseEvent):void {
      // Asynchronous call to the java service
      _proxy.echo("hello", onMethodResult);
   }
 
   private function onMethodResult(event:MethodReturnEvent):void {
      if (event.error != null) {
         Alert.show("Error calling echo: " + event.error.message);
      } else {
         Alert.show(event.result as String);
      }
   }