| 1 |
package test |
|---|
| 2 |
{ |
|---|
| 3 |
import flash.display.Sprite; |
|---|
| 4 |
|
|---|
| 5 |
public class Base extends Sprite |
|---|
| 6 |
{ |
|---|
| 7 |
private var _centered:Boolean; |
|---|
| 8 |
public function get centered():Boolean{return _centered;} |
|---|
| 9 |
public function set centered(value:Boolean):void |
|---|
| 10 |
{ |
|---|
| 11 |
_centered = value; |
|---|
| 12 |
draw(); |
|---|
| 13 |
} |
|---|
| 14 |
|
|---|
| 15 |
public var defaultCentered:Boolean = false; |
|---|
| 16 |
|
|---|
| 17 |
private var _color:uint; |
|---|
| 18 |
public function get color():uint{return _color;} |
|---|
| 19 |
public function set color(value:uint):void |
|---|
| 20 |
{ |
|---|
| 21 |
_color = value; |
|---|
| 22 |
draw(); |
|---|
| 23 |
} |
|---|
| 24 |
|
|---|
| 25 |
private var _width:Number; |
|---|
| 26 |
public override function get width():Number{return _width;} |
|---|
| 27 |
public override function set width(value:Number):void |
|---|
| 28 |
{ |
|---|
| 29 |
_width = value; |
|---|
| 30 |
draw(); |
|---|
| 31 |
} |
|---|
| 32 |
|
|---|
| 33 |
private var _height:Number; |
|---|
| 34 |
public override function get height():Number{return _height;} |
|---|
| 35 |
public override function set height(value:Number):void |
|---|
| 36 |
{ |
|---|
| 37 |
_height = value; |
|---|
| 38 |
draw(); |
|---|
| 39 |
} |
|---|
| 40 |
|
|---|
| 41 |
public function Base() |
|---|
| 42 |
{ |
|---|
| 43 |
_color = 0xffffff; |
|---|
| 44 |
_width = _height = 10; |
|---|
| 45 |
_centered = defaultCentered; |
|---|
| 46 |
draw(); |
|---|
| 47 |
} |
|---|
| 48 |
|
|---|
| 49 |
internal function draw():void |
|---|
| 50 |
{ |
|---|
| 51 |
graphics.clear(); |
|---|
| 52 |
|
|---|
| 53 |
graphics.beginFill(color); |
|---|
| 54 |
graphics.lineStyle(1, 0x000000); |
|---|
| 55 |
drawShape(_centered ? -_width / 2 : 0, _centered ? -_height / 2 : 0); |
|---|
| 56 |
graphics.endFill(); |
|---|
| 57 |
} |
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 |
internal function drawShape(offsetX:Number, offsetY:Number):void |
|---|
| 61 |
{ |
|---|
| 62 |
} |
|---|
| 63 |
} |
|---|
| 64 |
} |
|---|
| 65 |
|
|---|