The addEventListener for MOUSE_UP doesn’t work -> anybody know whats wrong? It works if I remove the enter_frame line
The addEventListener for MOUSE_UP doesn’t work -> anybody know whats wrong? It works if
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is a pretty common pattern in Flash for when you’re doing drag/drop stuff. Basically what is going on is that if you move the target out from under the mouse cursor (or if you move the mouse cursor out from over the target) then the MouseUp event never fires.
The easiest solution, and one I’ve used frequently, is to change the target of your MouseUp event listener. Rather than listening on the item you’re trying to drag, listen on stage instead.
The alternative, and this is desired behavior in some cases, is to listen to both MouseEvent.MOUSE_UP and MouseEvent.MOUSE_OUT on your target item. This way you can stop the drag immediately if the mouse ever leaves that item.
Does that make sense? Let me know if that helps!