1
|
ace.define("ace/snippets/actionscript",["require","exports","module"], function(require, exports, module) {
|
2
|
"use strict";
|
3
|
|
4
|
exports.snippetText = "snippet main\n\
|
5
|
package {\n\
|
6
|
import flash.display.*;\n\
|
7
|
import flash.Events.*;\n\
|
8
|
\n\
|
9
|
public class Main extends Sprite {\n\
|
10
|
public function Main ( ) {\n\
|
11
|
trace(\"start\");\n\
|
12
|
stage.scaleMode = StageScaleMode.NO_SCALE;\n\
|
13
|
stage.addEventListener(Event.RESIZE, resizeListener);\n\
|
14
|
}\n\
|
15
|
\n\
|
16
|
private function resizeListener (e:Event):void {\n\
|
17
|
trace(\"The application window changed size!\");\n\
|
18
|
trace(\"New width: \" + stage.stageWidth);\n\
|
19
|
trace(\"New height: \" + stage.stageHeight);\n\
|
20
|
}\n\
|
21
|
\n\
|
22
|
}\n\
|
23
|
\n\
|
24
|
}\n\
|
25
|
snippet class\n\
|
26
|
${1:public|internal} class ${2:name} ${3:extends } {\n\
|
27
|
public function $2 ( ) {\n\
|
28
|
(\"start\");\n\
|
29
|
}\n\
|
30
|
}\n\
|
31
|
snippet all\n\
|
32
|
package name {\n\
|
33
|
\n\
|
34
|
${1:public|internal|final} class ${2:name} ${3:extends } {\n\
|
35
|
private|public| static const FOO = \"abc\";\n\
|
36
|
private|public| static var BAR = \"abc\";\n\
|
37
|
\n\
|
38
|
// class initializer - no JIT !! one time setup\n\
|
39
|
if Cababilities.os == \"Linux|MacOS\" {\n\
|
40
|
FOO = \"other\";\n\
|
41
|
}\n\
|
42
|
\n\
|
43
|
// constructor:\n\
|
44
|
public function $2 ( ){\n\
|
45
|
super2();\n\
|
46
|
trace(\"start\");\n\
|
47
|
}\n\
|
48
|
public function name (a, b...){\n\
|
49
|
super.name(..);\n\
|
50
|
lable:break\n\
|
51
|
}\n\
|
52
|
}\n\
|
53
|
}\n\
|
54
|
\n\
|
55
|
function A(){\n\
|
56
|
// A can only be accessed within this file\n\
|
57
|
}\n\
|
58
|
snippet switch\n\
|
59
|
switch(${1}){\n\
|
60
|
case ${2}:\n\
|
61
|
${3}\n\
|
62
|
break;\n\
|
63
|
default:\n\
|
64
|
}\n\
|
65
|
snippet case\n\
|
66
|
case ${1}:\n\
|
67
|
${2}\n\
|
68
|
break;\n\
|
69
|
snippet package\n\
|
70
|
package ${1:package}{\n\
|
71
|
${2}\n\
|
72
|
}\n\
|
73
|
snippet wh\n\
|
74
|
while ${1:cond}{\n\
|
75
|
${2}\n\
|
76
|
}\n\
|
77
|
snippet do\n\
|
78
|
do {\n\
|
79
|
${2}\n\
|
80
|
} while (${1:cond})\n\
|
81
|
snippet while\n\
|
82
|
while ${1:cond}{\n\
|
83
|
${2}\n\
|
84
|
}\n\
|
85
|
snippet for enumerate names\n\
|
86
|
for (${1:var} in ${2:object}){\n\
|
87
|
${3}\n\
|
88
|
}\n\
|
89
|
snippet for enumerate values\n\
|
90
|
for each (${1:var} in ${2:object}){\n\
|
91
|
${3}\n\
|
92
|
}\n\
|
93
|
snippet get_set\n\
|
94
|
function get ${1:name} {\n\
|
95
|
return ${2}\n\
|
96
|
}\n\
|
97
|
function set $1 (newValue) {\n\
|
98
|
${3}\n\
|
99
|
}\n\
|
100
|
snippet interface\n\
|
101
|
interface name {\n\
|
102
|
function method(${1}):${2:returntype};\n\
|
103
|
}\n\
|
104
|
snippet try\n\
|
105
|
try {\n\
|
106
|
${1}\n\
|
107
|
} catch (error:ErrorType) {\n\
|
108
|
${2}\n\
|
109
|
} finally {\n\
|
110
|
${3}\n\
|
111
|
}\n\
|
112
|
# For Loop (same as c.snippet)\n\
|
113
|
snippet for for (..) {..}\n\
|
114
|
for (${2:i} = 0; $2 < ${1:count}; $2${3:++}) {\n\
|
115
|
${4:/* code */}\n\
|
116
|
}\n\
|
117
|
# Custom For Loop\n\
|
118
|
snippet forr\n\
|
119
|
for (${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) {\n\
|
120
|
${5:/* code */}\n\
|
121
|
}\n\
|
122
|
# If Condition\n\
|
123
|
snippet if\n\
|
124
|
if (${1:/* condition */}) {\n\
|
125
|
${2:/* code */}\n\
|
126
|
}\n\
|
127
|
snippet el\n\
|
128
|
else {\n\
|
129
|
${1}\n\
|
130
|
}\n\
|
131
|
# Ternary conditional\n\
|
132
|
snippet t\n\
|
133
|
${1:/* condition */} ? ${2:a} : ${3:b}\n\
|
134
|
snippet fun\n\
|
135
|
function ${1:function_name}(${2})${3}\n\
|
136
|
{\n\
|
137
|
${4:/* code */}\n\
|
138
|
}\n\
|
139
|
# FlxSprite (usefull when using the flixel library)\n\
|
140
|
snippet FlxSprite\n\
|
141
|
package\n\
|
142
|
{\n\
|
143
|
import org.flixel.*\n\
|
144
|
\n\
|
145
|
public class ${1:ClassName} extends ${2:FlxSprite}\n\
|
146
|
{\n\
|
147
|
public function $1(${3: X:Number, Y:Number}):void\n\
|
148
|
{\n\
|
149
|
super(X,Y);\n\
|
150
|
${4: //code...}\n\
|
151
|
}\n\
|
152
|
\n\
|
153
|
override public function update():void\n\
|
154
|
{\n\
|
155
|
super.update();\n\
|
156
|
${5: //code...}\n\
|
157
|
}\n\
|
158
|
}\n\
|
159
|
}\n\
|
160
|
\n\
|
161
|
";
|
162
|
exports.scope = "actionscript";
|
163
|
|
164
|
}); (function() {
|
165
|
ace.require(["ace/snippets/actionscript"], function(m) {
|
166
|
if (typeof module == "object" && typeof exports == "object" && module) {
|
167
|
module.exports = m;
|
168
|
}
|
169
|
});
|
170
|
})();
|
171
|
|