Packagevegas.events
Classpublic class Delegate
InheritanceDelegate Inheritance CoreObject
ImplementsEventListener, ICloneable, IRunnable

Delegate was originally created by Mike Chambers for Macromedia mx.events package.

This version is also inspired from Peter Hall's EventDelegate implementation and from the Francis bourre framework "Pixlib".

You can instantiate and keep a reference of a Delegate instance.

In the VEGAS implementation :

  • The Delegate class implements EventListener interface. you can use a Delegate instances in the addEventListener method for all EventTarget implementations.
  • The Delegate class implements IRunnable interface


  • Public Methods
     MethodDefined by
      
    Delegate(scope:*, method:Function, ... arguments)
    Creates a new Delegate instance.
    Delegate
      
    addArguments(... arguments):void
    Adds arguments to proxy method.
    Delegate
      
    clone():*
    Returns a shallow copy of the instance.
    Delegate
      
    create(scope:*, method:Function, ... arguments):Function
    [static] Creates a method that delegates its arguments to a specified scope.
    Delegate
      
    getArguments():Array
    Returns the array of all arguments called in the proxy method.
    Delegate
     Inherited
    Returns the internal ILogger reference of this ILogable object.
    CoreObject
      
    getMethod():Function
    Returns the proxy method reference.
    Delegate
      
    Returns the scope reference.
    Delegate
      
    handleEvent(e:Event):void
    Handles the event.
    Delegate
     Inherited
    hashCode():uint
    Returns a hashcode value for the object.
    CoreObject
      
    run(... arguments):void
    Run the proxy method in the provided context.
    Delegate
      
    setArguments(... arguments):void
    Sets or change arguments of proxy method.
    Delegate
     Inherited
    setLogger(log:ILogger = null):void
    Sets the internal ILogger reference of this ILogable object.
    CoreObject
     Inherited
    toSource(indent:int = 0):String
    Returns the string representation the source code of the object.
    CoreObject
     Inherited
    toString():String
    Returns the string representation of this instance.
    CoreObject
    Constructor detail
    Delegate()constructor
    public function Delegate(scope:*, method:Function, ... arguments)

    Creates a new Delegate instance.

    Parameters
    scope:* — the scope to be used by calling this method.
     
    method:Function — the method to be executed.
     
    ... arguments — the optional argument to pass in the method.
    Method detail
    addArguments()method
    public function addArguments(... arguments):void

    Adds arguments to proxy method.

    Parameters
    ... arguments
    clone()method 
    public function clone():*

    Returns a shallow copy of the instance.

    Returns
    * — a shallow copy of the instance.
    create()method 
    public static function create(scope:*, method:Function, ... arguments):Function

    Creates a method that delegates its arguments to a specified scope. This static method is a wrapper for MM compatibility.

    Parameters
    scope:* — this scope to be used by calling this method.
     
    method:Function — the method to be called.
     
    ... arguments

    Returns
    Function — a Function that delegates its call to a custom scope, method and arguments.
    getArguments()method 
    public function getArguments():Array

    Returns the array of all arguments called in the proxy method.

    Returns
    Array — the array of all arguments called in the proxy method.
    getMethod()method 
    public function getMethod():Function

    Returns the proxy method reference.

    Returns
    Function — the proxy method reference.
    getScope()method 
    public function getScope():*

    Returns the scope reference.

    Returns
    * — the scope reference.
    handleEvent()method 
    public function handleEvent(e:Event):void

    Handles the event.

    Parameters
    e:Event
    run()method 
    public function run(... arguments):void

    Run the proxy method in the provided context.

    Parameters
    ... arguments
    setArguments()method 
    public function setArguments(... arguments):void

    Sets or change arguments of proxy method.

    Parameters
    ... arguments