WEB开发网
开发学院图形图像Flash 第二章 ActionScript 3.0 动画基础Ⅱ[FL 基理译] 阅读

第二章 ActionScript 3.0 动画基础Ⅱ[FL 基理译]

 2009-05-30 12:08:54 来源:WEB开发网   
核心提示: package {import flash.display.Sprite;import flash.events.MouseEvent;public class MouseEvents extends Sprite { public function MouseEvents() { ini

package {
 import flash.display.Sprite;
 import flash.events.MouseEvent;
 public class MouseEvents extends Sprite {
  public function MouseEvents() {
   init();
  }
  private function init():void {
   var sprite:Sprite = new Sprite();
   addChild(sprite);
   sprite.graphics.beginFill(0xff0000);
   sprite.graphics.drawCircle(0, 0, 50);
   sprite.graphics.endFill();
   sprite.x = stage.stageWidth / 2;
   sprite.y = stage.stageHeight / 2;
   sprite.addEventListener(MouseEvent.CLICK, onMouseEvent);
   sprite.addEventListener(MouseEvent.DOUBLE_CLICK,onMouseEvent);
   sprite.addEventListener(MouseEvent.MOUSE_DOWN,onMouseEvent);
   sprite.addEventListener(MouseEvent.MOUSE_MOVE,onMouseEvent);
   sprite.addEventListener(MouseEvent.MOUSE_OUT,onMouseEvent);
   sprite.addEventListener(MouseEvent.MOUSE_OVER,onMouseEvent);
   sprite.addEventListener(MouseEvent.MOUSE_UP,onMouseEvent);
   sprite.addEventListener(MouseEvent.MOUSE_WHEEL,onMouseEvent);
   sprite.addEventListener(MouseEvent.ROLL_OUT,onMouseEvent);
   sprite.addEventListener(MouseEvent.ROLL_OVER,onMouseEvent);
  }
  public function onMouseEvent(event:MouseEvent):void {
   trace(event.type);
  }
 }
}

上一页  3 4 5 6 7 8 9 10  下一页

Tags:第二章 ActionScript 动画

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接