-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathArsenal.as
80 lines (56 loc) · 1.21 KB
/
Arsenal.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
package {
import flash.display.MovieClip;
import flash.events.Event;
import flash.geom.ColorTransform;
public class Arsenal extends MovieClip {
protected var time:int;
protected var up:Boolean;
protected var is_flashing:Boolean;
public function Arsenal() {
// constructor code
time = 1;
up = true;
is_flashing = false;
}
public function f(t:int):int
{
//Flash对时间的函数
return t*5;
}
public function Flashing(e:Event):void
{
if (time >= 50)
{
up = false;
}
else if (time <= 1)
{
up = true;
}
if (up)
{
time++;
}
else
{
time--;
}
transform.colorTransform = new ColorTransform(1, 1, 1, 1, f(time), f(time), f(time), 0);
}
public function Update(respawning_time:int):void
{
alpha = 1-Number(respawning_time/1000);
if (respawning_time <= 0 && is_flashing==false)
{
is_flashing = true;
addEventListener(Event.ENTER_FRAME, Flashing);
}
else if(is_flashing==true && respawning_time>0)
{
is_flashing = false;
removeEventListener(Event.ENTER_FRAME, Flashing);
transform.colorTransform = new ColorTransform();
}
}
}
}