Packagecom.bourre.commands
Classpublic class Delegate
ImplementsCommand, TickListener

Player version: Flash Player 9.0
Language version: ActionScript 3.0

The Delegate encapsulate a method call as an object. The Delegate class provides two ways to encapsulate a method call :



Protected Properties
 PropertyDefined by
  _a : Array
Array of arguments to pass to the function
Delegate
  _bHasEventCallback : Boolean
Indicates whether the event object passed to the execute method is appended to the function arguments or not.
Delegate
  _f : Function
The method closure wrapped by this delegate
Delegate
Public Methods
 MethodDefined by
  
Delegate(f:Function, ... rest)
Creates a new Delegate instance which encapsulate the call to the passed-in function with the passed-in rest as arguments to the function.
Delegate
  
addArguments(... rest):void
Appends arguments to the current function's arguments.
Delegate
  
addArgumentsArray(a:Array):void
Appends arguments to the current function's arguments.
Delegate
  
bypassEventCallback(b:Boolean):void
If true the event passed to the execute function will not be appended to the function arguments.
Delegate
  
Calls the function with the current array of arguments.
Delegate
  
create(method:Function, ... args):Function
[static] Creates a anonymous function which will wrap the call to the passed-in function with the passed-in rest as arguments to the function.
Delegate
  
execute(event:Event = null):void
Realizes the function call with the arguments defined in this Delegate object.
Delegate
  
getArguments():Array
Returns the current array of arguments which will be passed to the function when called.
Delegate
  
handleEvent(e:Event):void
Allow the delegate object to be added as listener for any event type on any object which provide the addEventListener.
Delegate
  
onTick(e:Event = null):void
Method called by the TickBeacon for each step of time according to its time slicing approach.
Delegate
  
setArguments(... rest):void
Defines the arguments to pass to the function
Delegate
  
setArgumentsArray(a:Array):void
Defines the arguments to pass to the function
Delegate
  
toString():String
Returns the string representation of this instance.
Delegate
Property detail
_aproperty
protected var _a:Array

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Array of arguments to pass to the function

_bHasEventCallbackproperty 
protected var _bHasEventCallback:Boolean

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Indicates whether the event object passed to the execute method is appended to the function arguments or not.

_fproperty 
protected var _f:Function

Player version: Flash Player 9.0
Language version: ActionScript 3.0

The method closure wrapped by this delegate

Constructor detail
Delegate()constructor
public function Delegate(f:Function, ... rest)

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Creates a new Delegate instance which encapsulate the call to the passed-in function with the passed-in rest as arguments to the function.

Parameters
f:Function — specified method to encapsulate
 
... rest — additionall arguments to pass to pass to the method
Method detail
addArguments()method
public function addArguments(... rest):void

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Appends arguments to the current function's arguments.

Parameters
... rest — arguments to append to the function's arguments
addArgumentsArray()method 
public function addArgumentsArray(a:Array):void

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Appends arguments to the current function's arguments.

Parameters
a:Array — array of arguments to append to the function's arguments
bypassEventCallback()method 
public function bypassEventCallback(b:Boolean):void

Player version: Flash Player 9.0
Language version: ActionScript 3.0

If true the event passed to the execute function will not be appended to the function arguments.

Parameters
b:Booleantrue to bypass the event to be appended to the function arguments
callFunction()method 
public function callFunction():*

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Calls the function with the current array of arguments.

Returns
*
create()method 
public static function create(method:Function, ... args):Function

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Creates a anonymous function which will wrap the call to the passed-in function with the passed-in rest as arguments to the function.

Parameters
method:Function — specified method to encapsulate
 
... args — additionall arguments to pass to pass to the method

Returns
Function — an anonymous function which will wrap the call to the passed-in function
execute()method 
public function execute(event:Event = null):void

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Realizes the function call with the arguments defined in this Delegate object.

The receive event will be append to the arguments array except if the bypassEvenCallback have been called with true as argument.

Parameters
event:Event (default = null) — event object to append to the arguments array
getArguments()method 
public function getArguments():Array

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Returns the current array of arguments which will be passed to the function when called.

Returns
Array — array of arguments which will be passed to the function
handleEvent()method 
public function handleEvent(e:Event):void

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Allow the delegate object to be added as listener for any event type on any object which provide the addEventListener.

Parameters
e:Event — event object dispatched with the event
onTick()method 
public function onTick(e:Event = null):void

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Method called by the TickBeacon for each step of time according to its time slicing approach.

The onTick method is very similar to the old onEnterFrame method, but doesn't specifically occurs when entering in a new frame of a frame-based animation. The tick could be the result of a setInterval call, or a change in the timecode of a video.

Parameters
e:Event (default = null) — event dispatched by the beacon object
setArguments()method 
public function setArguments(... rest):void

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Defines the arguments to pass to the function

Parameters
... rest — arguments to pass to the function
setArgumentsArray()method 
public function setArgumentsArray(a:Array):void

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Defines the arguments to pass to the function

Parameters
a:Array — array of arguments to pass to the function
toString()method 
public function toString():String

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Returns the string representation of this instance.

Returns
String — the string representation of this instance