Creating Mouse Interactions : MouseEvent « Development « Flash / Flex / ActionScript






Creating Mouse Interactions

 
package {
  import flash.display.Sprite;
  import flash.events.*;
  import flash.geom.Point;

  public class Main extends Sprite {
    public function Main(  ) {
      var circle:Sprite = new Sprite(  );
      circle.x = 10;
      circle.y = 10;
      circle.graphics.beginFill( 0xFF0000 );
      circle.graphics.drawCircle( 0, 0, 5 );
      circle.graphics.endFill(  );
      
      circle.addEventListener( MouseEvent.MOUSE_MOVE, handleMouseMove );

      addChild( circle );
    }
    
    private function handleMouseMove( event:MouseEvent ):void {
      trace( "mouse move" );
    }
  }
}

        








Related examples in the same category

1.Responding to Mouse and Key Events
2.Mouse Events and Overlapping Display Objects
3.mouseEnabled = false
4.Finding the mouse pointer's position
5.A custom mouse pointer
6.Handling Mouse Events "Globally"
7.Global Mouse Down Sensor
8.Mouse Events and Modifier Keys
9.Mouse Event Hierarchy
10.All types of mouse event
11.Using MouseEvent in Conjunction with the Mouse
12.Add mouse listener to state
13.Add mouse move listener
14.Add mouse up and down listener
15.Rollover Test
16.Click Test
17.Post-Event Screen Updates