4 Replies Latest reply on May 4, 2006 1:11 AM by Sean_Liang

    Bug of mouse events?

      var obj = new Object();
      obj.onMouseDown = function() {
      trace("Down - " + _root._xmouse + ":" + _root._ymouse);
      obj.onMouseUp = function() {
      trace("Up - " + _root._xmouse + ":" + _root._ymouse);

      For a click event, the two positions traced by MouseDown and MouseUp should be the same. For example,
      Down - 328:274
      Up - 328:274

      This is true for a normal click. However, if you right click (Windows only?) to show the context menu, then move your mouse around and click, the two positions ARE different.
      Down - 459:395
      Up - 546:179

      Obviously, the mouse position was saved before right click, and MouseMove event was not generated after that, that is, the new mouse position never be updated. That's weird. From my viewpoint, flash should at least update mouse position once get focus.

      Is that a bug of Flash, or is it working as designed?
        • 1. Re: Bug of mouse events?
          Rothrock Level 5
          Not really sure what you are talking about I don't get any of the behaviors you are talking about.

          Your code should give the position when the mouse button goes down and again when the mouse button goes up. The down and up should be the same only if you don't move the mouse.

          If you left click and hold the button and move the mouse the down and up will not be the same and the trace reflects that.

          However when I right click I get no traces at all.

          I am on a Mac so perhaps the player handles right clicks for the Mac differently.

          But in any event there is absolutely nothing wrong or unexpected about the results of this code. Why do you thing they should be the same? That is a wrong assumption.
          • 2. Bug of mouse events?
            Sean_Liang Level 1
            Rothrock, thanks for replying.
            You might misunderstand my meaning. To reproduce the problem I described:
            1. Run the code in Flash
            2. Press the RIGHT button of mouse, it should bring up the context menu (not sure about Mac)
            3. Move your mouse to somewhere else
            4. Press the LEFT button of mouse and release immediately, that is, a CLICK
            5. You should be able to see the different poistion for MouseDown and MouseUp, which was expected to be the same

            Thanks again.
            • 3. Re: Bug of mouse events?
              Rothrock Level 5
              I'm pretty sure I do understand. But on my Mac I'm not seeing any traces at all for the right click followed by the left click. So I can't really test it all out.

              However since you mentioned in the part about the left click that you expected them to be the same – which isn't necessarily true – I thought you might be assuming things you shouldn't.

              In any event I think you can find that the behaviour is even odder than you expected when you take into account the Mac platform strangeness.

              Is there a reason you attached this to an object and then added a listener? Why not just attach it to a movieclip or root. That might work differently/better. Maybe?
              • 4. Re: Bug of mouse events?
                Sean_Liang Level 1
                I've tried to use onClipEvent(mouseDown/mouseUp), and get the same result. My situation is: compare the mouse positions of MouseDown and MouseUp, if they are same, it is click action, else a drag. They lead to different result in my program. At the same time, there are some custom context menus in the Flash. It is possible for the users to show it but abort a selection.