| |
|
This is a very simple class made to simplify the process of binding a key to a function. This class has two static functions: bind and unbind for obvious purposes. All you need to do bind a key to a specific function is simply execute the Binder.bind function.
Syntax:
Binder.bind(key:String, func:Function, thisObject:[Object, MovieClip, ...], params:Array):Void;
Example:
Binder.bind("g", gotoAndPlay, _root, [6]);
func is the function to execute, thisObject is the object to which the function should be applied (thus making it a method), and params is an array of parameters for the function call. thisObject is not bound to a specific class - it can be a MovieClip, an Object, ... anything that can execute a method.
I personally added this class to the mx.utils folder, so that I can always use it by importing mx.utils.Binder, just like I do with Delegate. |