Thursday, October 14, 2010

Actionscript singleton class template IntelliJ Idea

Thanks to Gaurav Kushwaha, here is a singleton class template
for actionscript which you can use with Intellij Idea : 


package ${PACKAGE_NAME}#if (${PACKAGE_NAME} != "") #end
{
public class ${NAME} #if (${Super_class_name} != "")extends ${Super_class_name}#end{
private static var _instance:${NAME};

public static function getInstance():${NAME} {
    if (_instance == null) {
        _instance = new ${NAME}(new Dummy());
    }
    return _instance;
}
public function ${NAME}(dummy:Dummy) {
}

}
}
class Dummy {
    public function Dummy() {
}
}

No comments:

Blog Archive