create

public function create(s:String, p:Object, root:Object):void
Creates a class, subclass or static singleton. More details on this method can be found in the Wiki.

Examples

// Creates a basic class
tinymce.create('tinymce.somepackage.SomeClass', {
    SomeClass : function() {
        // Class constructor
    },

    method : function() {
        // Some method
    }
});

// Creates a basic subclass class
tinymce.create('tinymce.somepackage.SomeSubClass:tinymce.somepackage.SomeClass', {
    SomeSubClass: function() {
        // Class constructor
        this.parent(); // Call parent constructor
    },

    method : function() {
        // Some method
        this.parent(); // Call parent method
    },

    'static' : {
        staticMethod : function() {
            // Static method
        }
    }
});

// Creates a singleton/static class
tinymce.create('static tinymce.somepackage.SomeSingletonClass', {
    method : function() {
        // Some method
    }
});

Params

Name Type Description
s String Class name, inheritage and prefix.
p Object Collection of methods to add to the class.
root Object Optional root object defaults to the global window object.