3 Replies Latest reply on Jun 12, 2006 6:33 PM by Newsgroup_User

    onRollOver

    mr.morton
      Hi...

      I am using onRollOver to detect if the mouse is over a certain movieclip, and it works fine.

      my_mc.onRollOver = function(){
      Mouse.addListener(MyListener);
      }

      But in the movieclips i need to know if the mouse is over, I also need to be abled to press the mouse down on various buttons and other stuff inside the movieclip. But the onRollOver overrides everything else, so only that works.

      Can it be changed ?
        • 1. Re: onRollOver
          Level 7
          "mr.morton" <webforumsuser@macromedia.com> wrote in message news:e6kujt$e64$1@forums.macromedia.com...
          > Hi...
          >
          > I am using onRollOver to detect if the mouse is over a certain movieclip, and
          > it works fine.
          >
          > my_mc.onRollOver = function(){
          > Mouse.addListener(MyListener);
          > }
          >
          > But in the movieclips i need to know if the mouse is over, I also need to be
          > abled to press the mouse down on various buttons and other stuff inside the
          > movieclip. But the onRollOver overrides everything else, so only that works.
          >
          > Can it be changed ?

          Avoid having a vertical stack of duplicate mouse events, it's very troublesome. Better to use a hitTest on the movieclip and keep
          the onRollOver just for buttons inside the clip.
          tralfaz


          • 2. Re: onRollOver
            mr.morton Level 1
            Oki - so i'm not very good at flash....

            But i just can see how to make that wor, so i know when the mouse is over the movieclip and when it is not.


            Kind Regards
            Morton

            • 3. Re: onRollOver
              Level 7
              "mr.morton" <webforumsuser@macromedia.com> wrote in message news:e6l11v$gp5$1@forums.macromedia.com...
              > Oki - so i'm not very good at flash....
              >
              > But i just can see how to make that wor, so i know when the mouse is over the movieclip and when it is not.
              >
              >
              > Kind Regards
              > Morton
              >

              Here is an example of a movieclip that has two buttons inside of it. When the mouse is over the movieclip, the movieclip expands to
              130% scale. When the mouse is not over the movieclip, the movieclip shrinks back to it's original size.

              Clicking on btn1 makes my_mc go to frame 1 and clicking on btn2 makes my_mc go to frame 2.

              // all code goes on frame 1 of main timeline (not attached to any clips or buttons)

              stop();

              // constant check to see if the mouse is over the movieclip:
              this.onEnterFrame = function()
              {
              if (hitTest(_root._xmouse, _root._ymouse))
              {
              this._xscale = 130;
              this._yscale = 130;
              }
              else
              {
              this._xscale = 100;
              this._yscale = 100;
              }
              }

              // code for btn1 inside of the movieclip my_mc
              my_mc.btn1.onRollOver = function()
              {
              _root.my_mc.gotoAndStop(1);
              }

              // code for btn2 inside of the movieclip my_mc
              my_mc.btn2.onRollOver = function()
              {
              _root.my_mc.gotoAndStop(2);
              }

              // don't forget to put instance names on the buttons and the movieclip.

              hope that helps,
              tralfaz