Un template simple mais efficace. Avec EventDispatcher/Listener, constructeur etc.
Bientôt d'autres templates !
Pour installer, aller dans les préférences de Actionscript dans eclipse, puis Text Editor, puis templates, enfin importez le fichier xml. Le template class doit remplacer le template class standard, pour cela assurez-vous qu'il n'y a qu'un seul template "class".
Lorsque vous créerez une classe, le template sera automatiquement appelé.
Pour l'utiliser manuellement, il vous suffira de taper "class" (sans guillemets) puis d'enfoncer les touches "ctrl" + "espace".
/**
* @author
* ${date}
*/
import mx.events.EventDispatcher;
class ${enclosing_package_and_type}
{
static public var _version : String ="0.1";
static public var _className : String="${enclosing_package_and_type}";
public var _name : String;
// events
public var dispatchEvent:Function;
public var addEventListener:Function;
public var removeEventListener:Function;
public static var initDispatch = EventDispatcher.initialize(${enclosing_type}.prototype);
// props
${cursor}
// constructor
public function ${enclosing_type}(initObj:Object)
{
for (var i : String in initObj) this[i] = initObj[i];
}
// init function
public function init()
{
}
public function toString(Void) : String
{
return "${enclosing_package_and_type}";
}
}