topical media & game development

talk show tell print

animation-ch04-DrawingCurves.ax

animation-ch04-DrawingCurves.ax [swf] [flash] flex


  package
  {
   import flash.display.Sprite;
   import flash.events.MouseEvent;
   
   public class @ax-animation-ch04-DrawingCurves extends Sprite
   {
    private var x0:Number = 100;
    private var y0:Number = 200;
    private var x1:Number;
    private var y1:Number;
    private var x2:Number = 300;
    private var y2:Number = 200;
  
    public function @ax-animation-ch04-DrawingCurves()
    {
     init();
    }
   

init(s)


    private function init():void
    {
     stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
    }
  

move(s)


    private function onMouseMove(event:MouseEvent):void
    {
     x1 = mouseX;
     y1 = mouseY;
     graphics.clear();
     graphics.lineStyle(1);
     graphics.moveTo(x0, y0);
     graphics.curveTo(x1, y1, x2, y2);
    }
   }
  }
  


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.