[SWF(width="1200", height="800", frameRate="60", backgroundColor="#F1F1F1")]
public class AVR extends Sprite
{
private var _button:Sprite = new Sprite();
public function AVR()
{
drawButton()
_button.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
addChild(_button);
}
private var _textLabel:TextField;
private var _count:int = 0;
private function drawButton():void {
_textLabel = new TextField()
_button.graphics.clear();
_button.graphics.beginFill(0xD4D4D4);
_button.graphics.drawRoundRect(80, 47, 100, 25, 10, 10);
_button.graphics.endFill();
_textLabel.text = "click count: 0";
_textLabel.x = 100;
_textLabel.y = 50;
_textLabel.height = 20;
_textLabel.width = 100;
_textLabel.selectable = false;
_button.addChild(_textLabel);
}
private function mouseDownHandler(event:MouseEvent):void {
_count++;
_textLabel.text = "click count: " + _count;
}
}