1 Reply Latest reply on Jun 29, 2007 9:42 AM by Newsgroup_User

    mouseX and mouseY

    tag_digital
      nevermind....I figured it out. mouseX and mouseY does give the reading on the stage, not the underlying symbol.
        • 1. Re: mouseX and mouseY
          Level 7
          tag_digital,

          > does the mouseX and mouseY property read where the
          > mouse is on the stage or where the mouse is over a symbol?

          It depends entirely on the object on which these properties are invoked.
          Ideally, to avoid confusion, they should be preceded by an object reference.
          In ActionScript 3.0, which is what it looks like you're using, these
          properties originate with the DisplayObject class. This class "passes its
          genes," so to speak, to numerous progeny, including movie clips and buttons
          (instances of the MovieClip and SimpleButton classes, respectively) and even
          the Stage.

          So the following quick example will show the mouse's x position in
          relation to the Stage:

          stage.addEventListener(
          Event.ENTER_FRAME,
          function():void {
          trace(stage.mouseX);
          }
          );

          While this will show the mouse's x position in relation to a movie clip
          symbol with the instance name "square":

          stage.addEventListener(
          Event.ENTER_FRAME,
          function():void {
          trace(square.mouseX);
          }
          );


          David Stiller
          Co-author, Foundation Flash CS3 for Designers
          http://tinyurl.com/2k29mj
          "Luck is the residue of good design."