-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDRPen.as
60 lines (40 loc) · 1.4 KB
/
DRPen.as
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
class DRPen {
static var pens:Object = new Object();
static var currentPen:DRPen;
function DRPen(name:String) {
DRPen.pens[name] = this;
}
static function setPen(penName:String) {
var newPen = DRPen.pens[penName];
if (newPen) {
currentPen = newPen;
Mouse.addListener(newPen);
Key.addListener(newPen);
_root.onEnterFrame = function() { newPen.onEnterFrame(); }
newPen.onPenDown();
}
}
function switchPen(penName:String) {
var newPen = DRPen.pens[penName];
if (newPen) {
currentPen = newPen;
Mouse.removeListener(this);
Mouse.addListener(newPen);
Key.removeListener(this);
Key.addListener(newPen);
_root.onEnterFrame = function() { newPen.onEnterFrame(); }
onPenUp();
newPen.onPenDown();
return newPen;
}
}
// Event Handlers:
function onEnterFrame() {}
function onPenDown() {}
function onPenUp() {}
function onMouseDown() {}
function onMouseMove() {}
function onMouseUp() {}
function onKeyDown() {}
function onKeyUp() {}
}