.flash filename="simpleb.swf" bbox=420x440 version=9 fps=12 background=#666666 .edittext log width=400 height=80 color=black multiline border .put log x=0 y=0 .action: package { import flash.display.*; class Box extends Shape { private var bgcol:uint; private var size:uint; public function Box(bgColor:uint, size:uint) { this.size=size; this.bgcol=bgColor; graphics.beginFill(bgColor); graphics.drawRect(20,20,size,size); graphics.endFill(); } } class Custom extends SimpleButton { public function Custom() { var size:uint = 40; downState = new Box(0x0000FF , size); overState = new Box(0x00FF000, size); upState = new Box(0xFF0000 , size); hitTestState = new Box(0 ,size*2);// expand clic zone hitTestState.x -=(size/2);// centre hitTestState.y -=(size/2); useHandCursor = true; } } public dynamic class Main extends MovieClip { private function trace (s) { this.log.text+=s+"\n"; } public function Main() { trace('simple custom button (3 classes)'); var button:Custom = new Custom(); addChild(button); } } } .end # action .end # .flash