Simple Scribble : stage « Development « Flash / Flex / ActionScript






Simple Scribble

 

package {
  import flash.display.*;
  import flash.events.*;

  public class Main extends Sprite {
    public function Main(  ) {
      stage.frameRate = 1;
      graphics.moveTo(stage.mouseX, stage.mouseY);
      stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveListener);
    }

    private function mouseMoveListener (e:MouseEvent):void {
      graphics.lineStyle(2, 0xFF0000);
      graphics.lineTo(e.stageX, e.stageY);
    }
  }
}

        








Related examples in the same category

1.Setting the Frame Rate
2.Traversing Objects in a Display Hierarchy
3.Recursive display list tree traversal
4.Distinguishing Events Targeted at an Object from Events Targeted at That Object's Descendants
5.responds to mouse clicks that occur over any object on the display list, but not over a vacant area of the Stage instance
6.A stretchy layout
7.Working with the Stage
8.Local Global Sample