4 Replies Latest reply on Jan 5, 2011 4:16 PM by Flex harUI

    MouseEvent not firing on DisplayObject click in AS only project in Flash Builder 4

    phi2265 Level 1

      Hello,


      I'm having difficulty getting MouseEvents to fire in an ActionScript only project. It doesn't make any sense to me. My code is below and this object is the top most object on the stage.

       

      var click:Sprite = new Sprite();

      click.name = 'clickLayer';

      click.mouseEnabled = true;

      click.addEventListener(MouseEvent.CLICK, mouseClickHandler);

      addChild(click);

      function mouseClickHandler(e:MouseEvent):void{

      trace('click');

      var url:String = loaderInfo.parameters.clickTag;

      navigateToURL(new URLRequest(url), '_blank');

      }

       

      My class extends Sprite.

       

      Everything else works fine. Something I found strange is that TextFields will fire MouseEvents when clicked if I add the EventListener, but not DisplayObjects.

       

      Thanks for your help.