// 設定發射子彈 stage.addEventListener(MouseEvent.MOUSE_DOWN, myshoot); function myshoot(event:MouseEvent): void { var temp:bullet_mc = new bullet_mc(); temp.x = mouseX; temp.y = mouseY; addChild(temp); temp.addEventListener(Event.ENTER_FRAME, bulletMove); } //讓字彈移動並漸漸縮小 function bulletMove(event:Event): void { if (event.target.scaleX > 0.3) { //一次縮小10% event.target.scaleX = event.target.scaleX - 0.1; event.target.scaleY = event.target.scaleY - 0.1; } else { event.target.parent.removeChild(event.target); event.target.removeEventListener(Event.ENTER_FRAME, bulletMove); } }