Global Mouse Down Sensor : MouseEvent « Development « Flash / Flex / ActionScript






Global Mouse Down Sensor

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

  public class Main extends Sprite {
    public function Main (  ) {
      stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownListener);
    }

    private function mouseDownListener (e:MouseEvent):void {
      trace("The primary mouse button was pressed.");
    }
  }
}

        








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.Mouse Events and Modifier Keys
8.Mouse Event Hierarchy
9.All types of mouse event
10.Using MouseEvent in Conjunction with the Mouse
11.Add mouse listener to state
12.Creating Mouse Interactions
13.Add mouse move listener
14.Add mouse up and down listener
15.Rollover Test
16.Click Test
17.Post-Event Screen Updates