2012-08-16 23:41:25 -04:00
|
|
|
snippet main
|
|
|
|
package {
|
|
|
|
import flash.display.*;
|
|
|
|
import flash.Events.*;
|
2013-07-17 19:06:05 -04:00
|
|
|
|
2012-08-16 23:41:25 -04:00
|
|
|
public class Main extends Sprite {
|
|
|
|
public function Main ( ) {
|
|
|
|
trace("start");
|
|
|
|
stage.scaleMode = StageScaleMode.NO_SCALE;
|
|
|
|
stage.addEventListener(Event.RESIZE, resizeListener);
|
|
|
|
}
|
2013-07-17 19:06:05 -04:00
|
|
|
|
2012-08-16 23:41:25 -04:00
|
|
|
private function resizeListener (e:Event):void {
|
|
|
|
trace("The application window changed size!");
|
|
|
|
trace("New width: " + stage.stageWidth);
|
|
|
|
trace("New height: " + stage.stageHeight);
|
|
|
|
}
|
2013-07-17 19:06:05 -04:00
|
|
|
|
2012-08-16 23:41:25 -04:00
|
|
|
}
|
2013-07-17 19:06:05 -04:00
|
|
|
|
2012-08-16 23:41:25 -04:00
|
|
|
}
|
|
|
|
snippet class
|
2013-11-16 14:45:48 -05:00
|
|
|
${1:public|internal} class ${2:name} ${0:extends } {
|
2012-08-16 23:41:25 -04:00
|
|
|
public function $2 ( ) {
|
|
|
|
("start");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
snippet all
|
|
|
|
package name {
|
|
|
|
|
2013-11-16 14:45:48 -05:00
|
|
|
${1:public|internal|final} class ${2:name} ${0:extends } {
|
2012-08-16 23:41:25 -04:00
|
|
|
private|public| static const FOO = "abc";
|
|
|
|
private|public| static var BAR = "abc";
|
|
|
|
|
|
|
|
// class initializer - no JIT !! one time setup
|
|
|
|
if Cababilities.os == "Linux|MacOS" {
|
|
|
|
FOO = "other";
|
|
|
|
}
|
|
|
|
|
|
|
|
// constructor:
|
|
|
|
public function $2 ( ){
|
|
|
|
super2();
|
|
|
|
trace("start");
|
|
|
|
}
|
|
|
|
public function name (a, b...){
|
|
|
|
super.name(..);
|
|
|
|
lable:break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function A(){
|
|
|
|
// A can only be accessed within this file
|
|
|
|
}
|
|
|
|
snippet switch
|
|
|
|
switch(${1}){
|
|
|
|
case ${2}:
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
snippet case
|
|
|
|
case ${1}:
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
break;
|
|
|
|
snippet package
|
|
|
|
package ${1:package}{
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
}
|
|
|
|
snippet wh
|
|
|
|
while ${1:cond}{
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
}
|
|
|
|
snippet do
|
|
|
|
do {
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
} while (${1:cond})
|
|
|
|
snippet for enumerate names
|
|
|
|
for (${1:var} in ${2:object}){
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
}
|
|
|
|
snippet for enumerate values
|
|
|
|
for each (${1:var} in ${2:object}){
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
}
|
|
|
|
snippet get_set
|
|
|
|
function get ${1:name} {
|
|
|
|
return ${2}
|
|
|
|
}
|
|
|
|
function set $1 (newValue) {
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
}
|
|
|
|
snippet interface
|
|
|
|
interface name {
|
2013-11-16 14:45:48 -05:00
|
|
|
function method(${1}):${0:returntype};
|
2012-08-16 23:41:25 -04:00
|
|
|
}
|
|
|
|
snippet try
|
|
|
|
try {
|
|
|
|
${1}
|
|
|
|
} catch (error:ErrorType) {
|
|
|
|
${2}
|
|
|
|
} finally {
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
}
|
|
|
|
# For Loop (same as c.snippet)
|
2013-04-13 13:45:21 -04:00
|
|
|
snippet for for (..) {..}
|
2012-08-16 23:41:25 -04:00
|
|
|
for (${2:i} = 0; $2 < ${1:count}; $2${3:++}) {
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
}
|
|
|
|
# Custom For Loop
|
|
|
|
snippet forr
|
|
|
|
for (${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) {
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
}
|
|
|
|
# If Condition
|
|
|
|
snippet if
|
|
|
|
if (${1:/* condition */}) {
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
}
|
|
|
|
snippet el
|
|
|
|
else {
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
}
|
|
|
|
# Ternary conditional
|
|
|
|
snippet t
|
2013-11-16 14:45:48 -05:00
|
|
|
${1:/* condition */} ? ${2:a} : ${0:b}
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet fun
|
|
|
|
function ${1:function_name}(${2})${3}
|
|
|
|
{
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
}
|
|
|
|
# FlxSprite (usefull when using the flixel library)
|
|
|
|
snippet FlxSprite
|
|
|
|
package
|
|
|
|
{
|
|
|
|
import org.flixel.*
|
|
|
|
|
|
|
|
public class ${1:ClassName} extends ${2:FlxSprite}
|
|
|
|
{
|
|
|
|
public function $1(${3: X:Number, Y:Number}):void
|
|
|
|
{
|
|
|
|
super(X,Y);
|
2013-07-17 19:06:05 -04:00
|
|
|
${4}
|
2012-08-16 23:41:25 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
override public function update():void
|
|
|
|
{
|
|
|
|
super.update();
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|