var c:Sprite = this["c0"]; c.addEventListener(MouseEvent.CLICK,onClick); var sp:Sprite = new Sprite(); addChild(sp); sp.graphics.beginFill(0x000000,0.5); sp.graphics.drawRect(0,0,200,200); sp.graphics.lineStyle(1,0xffff00); sp.graphics.drawRect(50,50,100,100); sp.graphics.endFill(); function onClick(event:MouseEvent):void { trace(event.target.name); }
时间: 2024-12-29 10:07:55