Graphics Reference
In-Depth Information
public final class BorderButton extends Sprite{
private var _bbParent:DisplayObjectContainer;
//the parent of the BorderButton
private var _halfThick:Number; //half the
thickness of the border line
private var _w:Number; //the width to draw the
BorderButton
private var _h:Number; //the height to draw
the BorderButton
private var _targetWindow:String; //the window
in which the targetURL will open
private var _destination:String; //the target
url
private var _playerType:String =
Capabilities.playerType.toLowerCase(); //check for local
testing
private var _extInterfaceAvailable:Boolean =
false; //true if in browser AND ExternalInterface.available
public function BorderButton(){
super();
}
public function
draw(parent:DisplayObjectContainer, outline:Boolean =
false, lineColor:uint = 0x000000, lineThickness:int =
1):void {
_bbParent = parent;
_bbParent.addChild(this);
_halfThick = lineThickness / 2;
_w = _bbParent.stage.stageWidth -
_halfThick;
_h = _bbParent.stage.stageHeight -
_halfThick;
graphics.lineStyle(lineThickness,
lineColor);
graphics.beginFill(0, 0);
graphics.drawRect(0, 0, _w, _h);
}
public function activate(targetUrl:String,
targetWindow:String = "_blank"):void {
buttonMode = true;
_destination = targetUrl;
_targetWindow = targetWindow;
if(!hasEventListener(MouseEvent.CLICK)){
addEventListener(MouseEvent.CLICK,
clickOut, false, 0, true);
}
}
public function erase():void{
if(_bbParent != null){
deactivate();
Search WWH ::




Custom Search