API Documentation for: 1.0.0

Utility Methods Class

Defined in: Utility Methods:36
Module: CreateJS

Various utilities that the CreateJS Suite uses. Utilities are created as separate files, and will be available on the createjs namespace directly.


 myObject.addEventListener("change", createjs.proxy(myMethod, scope));

Item Index




  • [fallbackMethod=null]
  • [name=null]

Defined in deprecate:40

Wraps deprecated methods so they still be used, but throw warnings to developers.

obj.deprecatedMethod = createjs.deprecate("Old Method Name", obj._fallbackMethod);

The recommended approach for deprecated properties is:

try {
    Obj    ect.defineProperties(object, {
        readyOnlyProp: { get: createjs.deprecate("readOnlyProp", function() { return this.alternateProp; }) },
        readWriteProp: {
            get: createjs.deprecate("readOnlyProp", function() { return this.alternateProp; }),
            set: createjs.deprecate("readOnlyProp", function(val) { this.alternateProp = val; })
} catch (e) {}


  • [fallbackMethod=null] Function optional

    A method to call when the deprecated method is used. See the example for how

  • [name=null] String optional

    The name of the method or property to display in the console warning. to deprecate properties.



If a fallbackMethod is supplied, returns a closure that will call the fallback method after logging the warning in the console.


  • subclass
  • superclass

Defined in extend:40

Sets up the prototype chain and constructor property for a new class.

This should be called right after creating the class constructor.

function MySubClass() {}
createjs.extend(MySubClass, MySuperClass);
MySubClass.prototype.doSomething = function() { }

var foo = new MySubClass();
console.log(foo instanceof MySuperClass); // true
console.log(foo.prototype.constructor === MySubClass); // true




Returns the subclass's new prototype.


  • array
  • searchElement

Defined in indexOf:40

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);


  • array Array

    Array to search for searchElement

  • searchElement Object

    Element to find in array.



The first index of searchElement in array.


  • subclass
  • prefix

Defined in promote:40

Promotes any methods on the super class that were overridden, by creating an alias in the format prefix_methodName. It is recommended to use the super class's name as the prefix. An alias to the super class's constructor is always added in the format prefix_constructor. This allows the subclass to call super class methods without using function.call, providing better performance.

For example, if MySubClass extends MySuperClass, and both define a draw method, then calling promote(MySubClass, "MySuperClass") would add a MySuperClass_constructor method to MySubClass and promote the draw method on MySuperClass to the prototype of MySubClass as MySuperClass_draw.

This should be called after the class's prototype is fully defined.

function ClassA(name) {
    this.name = name;
ClassA.prototype.greet = function() {
    return "Hello "+this.name;

function ClassB(name, punctuation) {
    this.punctuation = punctuation;
createjs.extend(ClassB, ClassA);
ClassB.prototype.greet = function() {
    return this.ClassA_greet()+this.punctuation;
createjs.promote(ClassB, "ClassA");

var foo = new ClassB("World", "!?!");
console.log(foo.greet()); // Hello World!?!


  • subclass Function

    The class to promote super class methods on.

  • prefix String

    The prefix to add to the promoted method names. Usually the name of the superclass.



Returns the subclass.


  • method
  • scope
  • [arg]
public static

Defined in proxy:51

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.


 myObject.addEventListener("event", createjs.proxy(myHandler, this, arg1, arg2));

 function myHandler(arg1, arg2) {
      // This gets called when myObject.myCallback is executed.


  • method Function

    The function to call

  • scope Object

    The scope to call the method name on

  • [arg] Mixed optional
    • Arguments that are appended to the callback for additional params.



Object static

Defined in BrowserDetect:42

An object that determines the current browser, version, operating system, and other environment variables via user agent string.

Used for audio because feature detection is unable to detect the many limitations of mobile devices.


 if (createjs.BrowserDetect.isIOS) { // do stuff }


  • isFirefox Boolean

    True if our browser is Firefox.

  • isOpera Boolean

    True if our browser is opera.

  • isChrome Boolean

    True if our browser is Chrome. Note that Chrome for Android returns true, but is a completely different browser with different abilities.

  • isIOS Boolean

    True if our browser is safari for iOS devices (iPad, iPhone, and iPod).

  • isAndroid Boolean

    True if our browser is Android.

  • isBlackberry Boolean

    True if our browser is Blackberry.