Repository navigation
Expand file tree
/
Copy pathPopFieldBoolean.as
More file actions
110 lines (88 loc) · 2.46 KB
/
Copy pathPopFieldBoolean.as
File metadata and controls
110 lines (88 loc) · 2.46 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
package popForm
//popForm.PopFieldBoolean
{
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.text.TextField;
import animation.Anim_Frame_Controller;
/**Boolean field changed*/
[Event(name="change", type="flash.events.Event")]
public class PopFieldBoolean extends PopFieldInterface
{
public var tagTF:TextField;
private var checkMC:MovieClip ;
private var backMC:MovieClip;
private var checkAnimation:Anim_Frame_Controller ;
private var lastCheckStatus:Boolean ;
private var IsArabic:Boolean,
myTitle:String;
public function PopFieldBoolean(tagName:String=null,defaultState:Boolean=false,isArabic:Boolean=true,languageFrame:uint=1,color:uint=1)
{
super();
this.addEventListener(MouseEvent.CLICK,switchBoolean);
if(tagName!=null)
{
setUp(tagName,defaultState,isArabic,languageFrame,color);
}
}
private function switchBoolean(e:*):void
{
lastCheckStatus = !lastCheckStatus ;
checkIt(lastCheckStatus);
this.dispatchEvent(new Event(Event.CHANGE));
}
private function checkIt(status:Boolean):void
{
if(checkAnimation!=null)
{
checkAnimation.gotoFrame(status==true?checkMC.totalFrames:1);
}
else
{
checkMC.visible = status ;
}
}
public function setUp(tagName:String,defaultState:Boolean=false,isArabic:Boolean=true,languageFrame:uint=1,color:uint=1):void
{
IsArabic = isArabic ;
myTitle = tagName ;
this.gotoAndStop(languageFrame);
backMC = Obj.get("back_mc",this);
backMC.stop();
changeColor(color);
var tagContainer:MovieClip = Obj.getAllChilds("tag_txt",this,true)[0];
tagTF = Obj.getAllChilds("tag_txt",tagContainer,true)[0];
checkMC = Obj.get("check_mc",this);
if(checkMC.totalFrames>1)
{
checkAnimation = new Anim_Frame_Controller(checkMC,1,false);
}
TextPutter.OnButton(tagTF,tagName,isArabic,true,false);
update(defaultState);
}
public function changeColor(colorFrame:uint):void
{
backMC.gotoAndStop(colorFrame);
}
override public function update(data:*):void
{
lastCheckStatus = data ;
checkIt(data);
}
override public function get title():String
{
return myTitle ;
}
override public function get data():*
{
//SaffronLogger.log("Get my date : "+date);
return lastCheckStatus ;
}
public function set data(value:Boolean):void
{
lastCheckStatus = value ;
checkIt(lastCheckStatus);
}
}
}