1 Reply Latest reply on Jul 19, 2006 10:48 PM by jpwrunyan

    MouseMove/MouseUp problem

    Jim the Knife
      Hi,

      I've got a panel that I open up on my MXML. Essentially, I would like to "drag-enable" the Panel using the mouseDown, mouseMove and mouseUp events. I realize that I can get this functionality with a TitleWindow, but I built this MXML using a panel and I'm just playing around. The control isn't playing ball, though. I initiate my "drag" in the mouseDown event, then check to see if buttonDown is true in the mouseMove event. I calculate the distance moved, then set myPanel.x and myPanel.y to the new coordinates to show a move. I put a few trace statements in to see what happens. The x and y properties are set correctly, but the next time the event fires, the x and y properties are back to the original settings when I started the "drag". So my panel doesn't move. I also tried putting something in the mouseUp event, to no avail.

      Is moving the control that fired a Mouse event during the event simply not allowed? If so, is that the case for all controls that inherit those events? If not, what's the trick?

      Thanks, Jim
        • 1. Re: MouseMove/MouseUp problem
          jpwrunyan Level 1
          Yes, well, there are two ways to do this:
          1) you can make an event listener on the Panel's title movie clip (you need to consult the code for Panel to get the instance names)--I actually did this once successfully before discovering:
          2) you can set the "isPopUp" property to "true". that is the property the PopUpManager sets when it attaches its own Panels

          as you probably know, the Panel needs to be in a canvas or container with layout="absolute" for this to work.