Fix hair, dick around with new game screen.
[18plus-7leafadventure.git] / src / org / sevenchan / dongs / ui / TinyButton.as
blobf88e390062e8890d91302516b9e2280d88c917ac
1 package org.sevenchan.dongs.ui
3 import flash.display.SimpleButton;
4 import flash.display.Shape;
5 import flash.display.Sprite;
6 import flash.events.Event;
7 import flash.events.MouseEvent;
8 import flash.text.TextField;
9 import flash.text.TextFormat;
10 import flash.text.TextFieldAutoSize;
11 import flash.text.TextFormatAlign;
13 /**
14 * ...
15 * @author Harbinger
17 public class TinyButton extends Sprite implements IHovertextRecipient
19 public var bgColor:uint = 0x000000;
20 public var fgColor:uint = 0xffffff;
21 private var textControl:TextField = new TextField();
22 private const padding:Number = 6;
23 public var alphaNormal:Number = 0.90;
24 public var alphaHover:Number = 0.75;
26 public function TinyButton(text:String)
28 this.textControl.text = text;
29 this.textControl.textColor = 0xffffff;
31 var tf:TextFormat = new TextFormat();
32 tf.font = "Verdana";
33 tf.bold = true;
34 tf.align = TextFormatAlign.CENTER;
35 this.textControl.setTextFormat(tf);
37 addChild(textControl);
38 this.addEventListener(MouseEvent.MOUSE_OVER, this.onMouseOver);
39 this.addEventListener(MouseEvent.MOUSE_OUT, this.onMouseOut);
40 this.alpha = alphaNormal;
41 draw();
44 public function setText(text:String):void {
45 textControl.text = text;
48 private function onMouseOver(e:MouseEvent):void {
49 this.alpha = alphaHover;
50 this.mouseChildren = false;
52 private function onMouseOut(e:MouseEvent):void {
53 this.alpha = alphaNormal;
56 public function draw():void {
57 graphics.clear();
58 graphics.beginFill(this.bgColor);
59 textControl.height = textControl.textHeight+4;
60 textControl.width = textControl.textWidth+3.5;
61 var w:Number = 16;
62 var h:Number = 16;
63 textControl.x = (w / 2) - (textControl.width / 2);
64 textControl.y = (h / 2) - (textControl.height / 2);
65 graphics.drawCircle(w/2, h/2, w/2);
66 graphics.endFill();
69 /* INTERFACE IHovertextRecipient */
71 public function setHoverText(text:String):void
76 public function getHoverText():String
78 return "";