ホームに戻る
 ActionScript3.0 アニメーション
package{
  import flash.display.Sprite;
  import flash.display.MovieClip;
  import flash.display.Graphics;
  import flash.events.Event;

[SWF(width="300", height="200", backgroundColor="0xFFFFFF")]

  public class Main extends Sprite
  {
    private var shape:Sprite;

    public function Main():void
    {
      stage.frameRate = 30;  // fps

      // Shape の設定
      shape = new Sprite();
      shape.x = 100;
      shape.y = 100;

      addChild(shape);

      var g:Graphics = shape.graphics;

      g.clear();

      // 図形の描画
      g.lineStyle(10, 0x000000, 1.0);  // 線の太さ、色、アルファ値
      g.beginFill(0xFF0000, 1.0);      // 面のスタイル設定
      g.drawRect(-40, -40, 80, 80); 
      g.endFill();

      shape.addEventListener(Event.ENTER_FRAME, onFrame);
    }

    private function onFrame(event:Event):void
    {
      shape.rotation += 1;
    }
  }
}

inserted by FC2 system