-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCircuitDot.as
75 lines (53 loc) · 1.37 KB
/
CircuitDot.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
package {
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.EventDispatcher;
import flash.filters.GlowFilter;
public class CircuitDot extends MovieClip {
const event_flash:String = "dot_flash";
private var flash_left_time:int;
private var dot_filter:Array;
public function CircuitDot() {
// constructor code
addEventListener(Event.ADDED_TO_STAGE, onAddToStage);
}
public function onAddToStage(e:Event):void
{
removeEventListener(Event.ADDED_TO_STAGE, onAddToStage);
stage.addEventListener(event_flash, Flash);
}
public function onRemoveFromStage(e:Event):void
{
stage.removeEventListener(event_flash, Flash);
removeEventListener(Event.REMOVED_FROM_STAGE, onRemoveFromStage);
}
public function Flash(e:Event=null):void
{
//闪一下
flash_left_time = 100;
dot_filter = [new GlowFilter(0xffffff, 0, 16, 16)];
filters = dot_filter;
addEventListener(Event.ENTER_FRAME, Flashing);
}
public function Flashing(e:Event):void
{
//动画内容
//filters.
if (flash_left_time > 50)
{
//强度增加
filters[0].alpha += 0.1;
}
else if (flash_left_time>0)
{
//强度减少
filters[0].alpha -= 0.1;
}
else
{
removeEventListener(Event.ENTER_FRAME, Flashing);
}
flash_left_time--;
}
}
}