Utility Methods Class
Various utilities that the CreateJS Suite uses. Utilities are created as separate files, and will be available on the createjs namespace directly:
Example
myObject.addEventListener("change", createjs.proxy(myMethod, scope));
Methods
indexOf
(
Number
-
array
-
searchElement
Finds the first occurrence of a specified value searchElement in the passed in array, and returns the index of that value. Returns -1 if value is not found.
var i = createjs.indexOf(myArray, myElementToFind);
Parameters:
Returns:
Number:
The first index of searchElement in array.
proxy
(
public
static
-
method
-
scope
-
[arg]
A function proxy for methods. By default, JavaScript methods do not maintain scope, so passing a method as a callback will result in the method getting called in the scope of the caller. Using a proxy ensures that the method gets called in the correct scope.
Additional arguments can be passed that will be applied to the function when it is called.
Example
myObject.addEventListener("event", createjs.proxy(myHandler, this, arg1, arg2));
function myHandler(arg1, arg2) {
// This gets called when myObject.myCallback is executed.
}