IntelliJ IDEA Custom ActionScript Event Template

Written by

I have created a small file template for creating custom Event classes quickly and easily using IntelliJ IDEA. Simply go to Preferences > [IDE Settings] File Templates > Create a new template [click the + icon] > Name it i.e. ActionScript Event | Give it an extension i.e. as | enter the below script and your sorted. Now if you right click on your project and select New > ActionScript Event you can enter the couple of defined params and your done and dusted.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package ${PACKAGE_NAME}#if (${PACKAGE_NAME} != "") #end{

import flash.events.Event;

public class ${NAME} extends Event {
    
    public static const ${CONST}:String = '${CONST}';
    #if (${eventObject} != "")
    public var ${eventObject}:${eventObjectClass};#end
    
    public function ${NAME}( type:String, 
                             #if (${eventObject} != "")
                             ${eventObject}:${eventObjectClass},#end   
                             bubbles:Boolean = false, 
                             cancelable:Boolean = false ) {
        super( type, bubbles, cancelable );
        #if (${eventObject} != "") this.${eventObject} = ${eventObject};#end 
    } 
    
    override public function clone():Event{
          return new ${NAME}( type,#if (${eventObject} != "") ${eventObject},#end bubbles, cancelable );
      }
}
}

Comments