ackage { import flash.display.Sprite; import flash.events.MouseEvent; public class pzzx extends Sprite { public function pzzx() { for (var i:int = 1; i < 7; i++) { var _sp:Sprite; _sp = into() as Sprite; addChild(_sp); _sp.x = 150; _sp.y = 150 + 40 * i; _sp.buttonMode = true; _sp.addEventListener(MouseEvent.MOUSE_MOVE,px); _sp.addEventListener(MouseEvent.MOUSE_OUT,px1); } } private function px(evt:MouseEvent):void { evt.target.width = 140; evt.target.height = 40; } private function px1(evt:MouseEvent):void { evt.target.width = 120; evt.target.height = 20; } private function into():Sprite { var sp:Sprite = new Sprite ; sp.graphics.beginFill(0x0000ff); sp.graphics.drawRect(-60,-10,120,20); sp.graphics.endFill(); return sp; } } }
|