class CustomSimpleButton extends SimpleButton { private var upColor:uint = 0x222222; private var overColor:uint = 0x444444; private var downColor:uint = 0x666666; private var size:uint = 80; private var caption:String; public function CustomSimpleButton(newSize:uint, newCaption:String = "Next"){ this.size = newSize; this.caption = newCaption; downState = new ButtonDisplayState(downColor, size, caption); overState = new ButtonDisplayState(overColor, size, caption); upState = new ButtonDisplayState(upColor, size, caption); hitTestState = new ButtonDisplayState(upColor, size, caption); hitTestState.x = 0; hitTestState.y = hitTestState.x; useHandCursor = true; } } class ButtonDisplayState extends Sprite { private var bgColor:uint; private var size:uint; private var caption: String; public function ButtonDisplayState(bgColor:uint, size:uint, caption: String) { this.caption = caption; this.bgColor = bgColor; this.size = size; draw(); } private function draw():void { graphics.lineStyle(1,0xFFFFFF,0.1); graphics.beginFill(bgColor); graphics.drawRect(0, 0, size, 20); graphics.endFill(); var textCaption: TextField = new TextField(); textCaption.x = 2; textCaption.y = 0; textCaption.text = this.caption.toUpperCase(); textCaption.textColor = 0xEEEEEE; textCaption.height = 20; addChild(textCaption); } }