-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathNumberString.as
More file actions
82 lines (66 loc) · 1.37 KB
/
Copy pathNumberString.as
File metadata and controls
82 lines (66 loc) · 1.37 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
package
{
public class NumberString
{
private var m_prefix: String = "";
private var m_suffix: String = "";
private var m_value: Number = 0;
private var m_text: String = "0";
private var object: *;
private var property: String;
public function NumberString (startValue: Number = 0, prefix: String = "", suffix: String = "")
{
m_prefix = prefix;
m_suffix = suffix;
m_value = startValue;
update();
}
public function bind (obj: *, prop: String = "text"): void
{
object = obj;
property = prop;
update();
}
public function get text (): String
{
return m_text;
}
public function set value(_value: int): void
{
if (_value == m_value) { return; }
m_value = _value;
update();
}
public function get value(): int
{
return m_value;
}
public function set prefix(_value: String): void
{
if (_value == m_prefix) { return; }
m_prefix = _value;
update();
}
public function get prefix(): String
{
return m_prefix;
}
public function set suffix(_value: String): void
{
if (_value == m_suffix) { return; }
m_suffix = _value;
update();
}
public function get suffix(): String
{
return m_suffix;
}
public function update (): void
{
m_text = m_prefix + String(m_value) + m_suffix;
if (object) {
object[property] = m_text;
}
}
}
}