1
4
5 import org.aswing.ASColor;
6 import org.aswing.graphices.*;
7
8
12 class org.aswing.graphices.SolidBrush implements Brush{
13 private var color:Number;
14 private var alpha:Number;
15
16
21 function SolidBrush(color:Object, alpha:Number){
22 if(color instanceof ASColor){
23 setASColor(ASColor(color));
24 }
25 else{
26 this.color=(color==undefined) ? ASColor.BLACK.getRGB():Number(color);
27 this.alpha=(alpha==undefined) ? 100:Number(alpha);
28 }
29 }
30
31 public function getColor():Number{
32 return color;
33 }
34
35 public function setColor(color:Number):Void{
36 if(color!=null){
37 this.color=color;
38 }
39 }
40
41 public function setAlpha(alpha:Number):Void{
42 if(alpha!=null){
43 this.alpha=alpha;
44 }
45 }
46
47 public function getAlpha():Number{
48 return alpha;
49 }
50
51 public function beginFill(target:MovieClip):Void{
52 target.beginFill(color,alpha);
53 }
54
55 public function endFill(target:MovieClip):Void{
56 target.endFill();
57 }
58
59 public function setASColor(color:ASColor):Void{
60 if(color!=null){
61 this.color=color.getRGB();
62 this.alpha=color.getAlpha();
63 }
64 }
65 }
66