-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathPrecentView.as
More file actions
73 lines (61 loc) · 1.51 KB
/
Copy pathPrecentView.as
File metadata and controls
73 lines (61 loc) · 1.51 KB
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
package mp3PlayerStatic
{//mp3PlayerStatic.PrecentView
import flash.display.MovieClip;
import flash.events.Event;
import flash.text.TextField;
public class PrecentView extends MovieClip
{
private var precentTF:TextField ;
public function PrecentView()
{
super();
precentTF = Obj.get("precent_txt",this);
setPrecentViewText(0)
this.mouseEnabled = false
this.mouseChildren = false
this.addEventListener(Event.ENTER_FRAME,cheker)
this.addEventListener(Event.REMOVED_FROM_STAGE,unload)
}
protected function unload(event:Event):void
{
if(MediaPlayerStatic.evt!=null)
{
MediaPlayerStatic.evt.removeEventListener(MediaPlayerEventStatic.DOWNLOAD_PRECENT,showPrecent)
}
this.removeEventListener(Event.ENTER_FRAME,cheker)
}
protected function cheker(event:Event):void
{
if(MediaPlayerStatic.evt!=null)
{
setPrecentViewText(0)
MediaPlayerStatic.evt.addEventListener(MediaPlayerEventStatic.DOWNLOAD_PRECENT,showPrecent)
this.removeEventListener(Event.ENTER_FRAME,cheker)
}
}
protected function showPrecent(event:MediaPlayerEventStatic):void
{
setPrecentViewText(event.downloadPrecent)
}
private function setPrecentViewText(Precent_p:Number):void
{
if(Precent_p==0)
{
this.visible = false
}
else
{
this.visible = true
}
if(precentTF!=null)
{
precentTF.text = Precent_p + '%'
}
if(Precent_p == 100)
{
precentTF.text =''
}
this.gotoAndStop(Precent_p)
}
}
}