File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55 - [ Packages] ( ./as3/packages.md )
66 - [ Types] ( ./as3/types.md )
77 - [ Type conversion] ( ./as3/type-conversion.md )
8+ - [ Type matching] ( ./as3/type-matching.md )
89 - [ Classes] ( ./as3/classes.md )
910 - [ Namespaces] ( ./as3/namespaces.md )
1011 - [ Events] ( ./as3/events.md )
1112 - [ Environment and target] ( ./as3/environment.md )
1213 - [ Embed] ( ./as3/embed.md )
14+ - [ Statements] ( ./as3/statements.md )
15+ - [ Switch] ( ./as3/statements/switch.md )
16+ - [ Try] ( ./as3/statements/try.md )
1317- [ Display list] ( ./display-list.md )
1418 - [ Points and scale factor] ( ./display-list/points.md )
Original file line number Diff line number Diff line change @@ -18,4 +18,68 @@ Define a constructor for a class using its name in a function definition:
1818class A {
1919 public function A() {}
2020}
21+ ```
22+
23+ ## Abstract classes
24+
25+ ```
26+ abstract class A {
27+ abstract function m():void;
28+ }
29+ ```
30+
31+ ## Static classes
32+
33+ ```
34+ static class Namespace {
35+ public static const VALUE:Number = 10.5;
36+ }
37+ ```
38+
39+ ## Final classes
40+
41+ ```
42+ final class A {}
43+
44+ class B extends A {} // ERROR!
45+ ```
46+
47+ ## Override
48+
49+ ```
50+ class A {
51+ function m() {}
52+ }
53+
54+ class B extends A {
55+ override function m() { trace("B!") }
56+ }
57+ ```
58+
59+ ## Final method
60+
61+ ```
62+ class A {
63+ final function m() {}
64+ }
65+
66+ class B extends A {
67+ override function m() { trace("B!") } // ERROR!
68+ }
69+ ```
70+
71+ ## Super
72+
73+ ```
74+ class A {
75+ function A() { trace("A!") }
76+
77+ function m() { trace("A.m!") }
78+ }
79+
80+ class B extends A {
81+ function B() { super(); trace("B!") }
82+
83+ override function m() { super.m(); trace("B.m!") }
84+ }
2185```
Original file line number Diff line number Diff line change 1+ # Statements
Original file line number Diff line number Diff line change 1+ # Switch
2+
3+ The switch statement, as opposed to the standard, does not support fallthrough in cases.
4+
5+ ```
6+ switch (0) {
7+ case 0: {
8+ trace("zero");
9+ }
10+ case 1: {
11+ trace("one");
12+ }
13+ }
14+ ```
15+
16+ The above prints "zero", not "zero" then "one".
Original file line number Diff line number Diff line change 1+ # Try
2+
3+ ```
4+ try {
5+ //
6+ } catch (e: SecurityError) {
7+ //
8+ } catch (e: RangeError) {
9+ //
10+ } finally {
11+ //
12+ }
13+ ```
Original file line number Diff line number Diff line change 1+ # Type matching
2+
3+ ## Type test
4+
5+ ```
6+ v is T
7+ ```
8+
9+ ## Switch
10+
11+ ```
12+ switch type (v) {
13+ case (n:Number) {
14+ trace("number");
15+ }
16+ default {
17+ trace("any other");
18+ }
19+ }
20+ ```
You can’t perform that action at this time.
0 commit comments