package { import flash.display.Sprite; import flash.display.SimpleButton; public class onButton extends Sprite { public function onButton():void { init(); } private function init():void { var a:Sprite=new Sprite(); huitu(a,0x00ff00); var b:Sprite=new Sprite(); huitu(b,0xff0000); var c:Sprite=new Sprite(); huitu(c,0x0000ff); /// var abc:SimpleButton=new SimpleButton(a,b,c,c); abc.x=abc.y=50; addChild(abc); //abc.addEventListener(MouseEvent.CLICK,abcclick) } private function huitu(obj:Sprite,col:uint):void { obj.graphics.beginFill(col); obj.graphics.drawRect(0,0,100,100); obj.graphics.endFill(); } } }