-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBar.as
90 lines (71 loc) · 2.26 KB
/
Bar.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
package {
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.filters.GlowFilter;
import flash.media.Sound;
public class Bar extends MovieClip {
public var index:int;
public static const click_event:String = "bar_click";
//public var des:String; //描述
public static var sound_flip:Sound;
public function Bar(i:int,ch:String,en:String) {
// constructor code
txtCh.text = ch;
txtEn.text = en;
//des = str;
index = i;
addEventListener(Event.ADDED_TO_STAGE, onAddToStage);
//addEventListener(MouseEvent.MOUSE_OVER, onOver);
sound_flip = new Sound_Tab();
}
public function onAddToStage(event:Event):void
{
removeEventListener(Event.ADDED_TO_STAGE, onAddToStage);
addEventListener(Event.REMOVED_FROM_STAGE, onRemoveFromStage);
addEventListener(MouseEvent.CLICK, onClick);
}
public function onRemoveFromStage(event:Event):void
{
removeEventListener(MouseEvent.CLICK, onClick);
removeEventListener(Event.REMOVED_FROM_STAGE, onRemoveFromStage);
}
public function onClick(event:MouseEvent):void
{
//trace(index);
/*
dispatchEvent(new Event("Info_Update", true));
dispatchEvent(new Event("OtherSelected", true));
dispatchEvent(new Event("Speed_Up", true));
MovieClip(parent).addEventListener("OtherSelected", onOtherSelected);
*/
dispatchEvent(new Event(click_event, true));
MovieClip(parent).addEventListener(click_event, onOtherSelected);
//添加滤镜
var gf:GlowFilter = new GlowFilter(0xFFFFFF, 1, 15, 15);
filters = [gf];
//声音
sound_flip.play();
}
public function onOver(event:MouseEvent):void
{
//removeEventListener(MouseEvent.MOUSE_OVER, onOver);
//addEventListener(MouseEvent.MOUSE_OUT, onOut);
//声音
//sound_flip.play();
}
public function onOut(event:MouseEvent):void
{
//removeEventListener(MouseEvent.MOUSE_OUT, onOut);
//addEventListener(MouseEvent.MOUSE_OVER, onOver);
}
public function onOtherSelected(event:Event):void
{
//MovieClip(parent).removeEventListener("OtherSelected", onOtherSelected);
MovieClip(parent).removeEventListener(click_event, onOtherSelected);
//消除滤镜
//trace("123");
filters = [];
}
}
}