title: Is it possible to SIMULATE a mouse click using a mouse down and up events?
body: <p>A previous question has gotten me thinking. Is it possible to simulate a MouseEvent.CLICK to get fired by just firing first a MOUSE_DOWN followed by a MOUSE_UP.</p>
  
  <p>As per Adobe's doumentation.
  "... For a click event to occur, it must always follow this series of events in the order of occurrence: mouseDown event, then mouseUp. The target object must be identical for both of these events; otherwise the click event does not occur. Any number of other mouse events can occur at any time between the mouseDown or mouseUp events; the click event still occurs."   <a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/InteractiveObject.html#event:click" rel="nofollow">http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/InteractiveObject.html#event:click</a></p>
  
  <p>From my tests it shows that the CLICK event is NOT constructed from the ActionScript 3 event queue. Or is something wrong with the code?</p>
  
  <p>See:  </p>
  
  <pre><code>package
  {
  import flash.display.Sprite;
  import flash.events.Event;
  import flash.events.MouseEvent;
  
  [SWF(backgroundColor="0xFFFFFF", frameRate="30", width="800", height="600")]
  
  public class Test extends Sprite
  {
      private var spr:Sprite = new Sprite();
      public function Test()
      {
          trace("Test()");
          this.addEventListener(Event.ADDED_TO_STAGE,init);
      }
      public function init(e:Event):void
      {
          trace("init()");
          spr.graphics.beginFill(0xFF0000);
          spr.graphics.drawRect(0,0,200,80);
          spr.graphics.endFill();
          addChild(spr);
          addEventListener(Event.ENTER_FRAME, onEnterFrame);
          spr.addEventListener(MouseEvent.CLICK, onClick);
      }
      private var tick:int = 0;
      private function onEnterFrame(e:Event):void
      {
          if (tick == 1) spr.dispatchEvent(new MouseEvent(MouseEvent.MOUSE_DOWN,true,false));
          if (tick == 2) spr.dispatchEvent(new MouseEvent(MouseEvent.MOUSE_UP,true,false));
          if (tick == 3) spr.dispatchEvent(new MouseEvent(MouseEvent.CLICK,true,false));
          tick++;
      }
      private function onClick(e:MouseEvent):void
      {
          trace("onClick() MouseEvent.CLICK dispatched"); 
      }
  }
  }
  </code></pre>
  
  <p>I should get TWO 'onClick()' events instead of one.</p>