I created a resizable container (Flash Builder / SDK 4), that listens to several mouse events. It has handles that you can drag to change its size. It has horizontal handles and vertical handles. The problem I have is that if I'm dragging the horizontal handle, for example, (changing its width) and I move the mouse down (out of the handler), the handle doesn't detect the MouseEvent.MOUSE_UP, when I release it. So, I need to be able to detect when the mouse left button is released anywhere in the application, so I can stop the deformation.
I tried something like:
but it didn't work as expected.
Any ideas will be appreciated.
Hopefully you actually called stage.addEventListener instead of
That should work unless the mouse is released outside of the SWF. In that
case you also need to listen for MOUSE_LEAVE
Thanks for your response.
Yes, I'm using "addEventListener", I just copied the wrong code here. This is the code I'm using:
if (stage != null && !stage.hasEventListener(MouseEvent.MOUSE_UP))
stage.addEventListener(MouseEvent.MOUSE_UP, handleDragStop, false, 0 ,true);
I think the problem is that stage is always null.This is a Flex porject, in Flash Builder, SDK 4.
Am I missing something here?
Depending on when you call it stage can be null. You can try