Circle.as
1.29 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
package control
{
import mx.core.UIComponent;
public class Circle extends UIComponent
{
public function Circle()
{
super();
}
private var _radius:Number = 20;
public function get radius():Number
{
return _radius;
}
public function set radius(value:Number):void
{
_radius = value;
invalidateDisplayList();
}
private var _borderColor:uint = 0x000000;
public function get borderColor():uint
{
return _borderColor;
}
public function set borderColor(value:uint):void
{
_borderColor = value;
invalidateDisplayList();
}
private var _backgroundColor:uint = 0xFF0000;
public function get backgroundColor():uint
{
return _backgroundColor;
}
public function set backgroundColor(value:uint):void
{
_backgroundColor = value;
invalidateDisplayList();
}
override protected function updateDisplayList(unscaledWidth:Number,
unscaledHeight:Number):void
{
super.updateDisplayList(5, 5);
graphics.clear();
if (isNaN(_radius))
return;
if (_radius <= 0)
return;
graphics.lineStyle(1, _borderColor, 1);
graphics.beginFill(_backgroundColor, 1);
graphics.drawCircle(Math.round(unscaledWidth / 2),
Math.round(unscaledHeight / 2), _radius);
graphics.endFill();
}
}
}