-
Notifications
You must be signed in to change notification settings - Fork 1
/
ChallengerAlertWindow.mxml
72 lines (64 loc) · 2.42 KB
/
ChallengerAlertWindow.mxml
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
<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" width="320" height="175" fontSize="13" title="Here comes a new challenger!!" horizontalScrollPolicy="off">
<mx:Script>
<![CDATA[
import flash.events.Event;
import mx.controls.*;
import mx.managers.PopUpManager;
import mx.utils.ObjectProxy;
[Bindable]
public var challenger:ObjectProxy;
public var _timer:Timer = new Timer(1000, 20);
[Bindable]
public var remainTime:int = 20;
public var declineComment:String = null;
public function startTimer():void {
_timer.addEventListener(TimerEvent.TIMER, _handleTick);
_timer.addEventListener(TimerEvent.TIMER_COMPLETE, _handleTimerComplete);
_timer.start();
}
private function _handleTick(e:TimerEvent):void {
remainTime -= 1;
}
private function _handleTimerComplete(e:TimerEvent):void {
_decline("Declined due to time-up.");
}
public function terminate():void {
_timer.stop();
PopUpManager.removePopUp(this);
}
private function _decline(comment:String):void {
_timer.stop();
declineComment = comment;
dispatchEvent(new Event("decline"));
PopUpManager.removePopUp(this);
}
private function _accept():void {
_timer.stop();
dispatchEvent(new Event("accept"));
PopUpManager.removePopUp(this);
}
]]>
</mx:Script>
<mx:VBox horizontalAlign="left" paddingLeft="10">
<mx:HBox>
<mx:VBox paddingRight="20">
<mx:HBox>
<mx:Label text="■" fontSize="14" color="{challenger.rankColor}"/>
<mx:Spacer width="-18"/>
<mx:Label text="{challenger.name}" fontSize="16" fontWeight="bold" />
</mx:HBox>
<mx:Label text=" {parentApplication.lan.country}: {challenger.country}"/>
</mx:VBox>
<mx:SWFLoader width="56" height="44" source="{challenger.flag_m}"/>
</mx:HBox>
<mx:Label text=" {parentApplication.lan.rate}: {challenger.rateStr}, ({challenger.rank})"/>
</mx:VBox>
<mx:VBox width="100%" horizontalAlign="center" paddingTop="5">
<mx:HBox>
<mx:Button id="acceptButton" click="_accept();" label="{parentApplication.lan.accept}"/>
<mx:Button id="rejectButton" click="_decline('Declined by opponent.');" label="{parentApplication.lan.reject}"/>
<mx:Label text="{remainTime}" fontSize="16" fontWeight="bold" />
</mx:HBox>
</mx:VBox>
</mx:TitleWindow>