View Full Version : [as3] replacement for releaseOutside?
smizzle
April 24th, 2007, 03:36 PM
Is there a replacement in as3 for releaseOutside? The mouseUp will only detect when you release over the object.
senocular
April 24th, 2007, 03:37 PM
http://www.kirupa.com/forum/showthread.php?p=1948182#post1948182
sarahelizabeth
April 24th, 2007, 03:53 PM
If you don't need to distinguish between a release on the object / outside the object, adding the mouse up listener to the stage also works.
smizzle
April 24th, 2007, 04:34 PM
Thanks!
uzairarshad
October 24th, 2010, 03:58 AM
Consider you are making a scroller and you have two button "upArrow" and "downArrow." Now, you must be wondering best place to add a listener on stage to detect mouse up outside. As you have two buttons on same level.
For this one of the good way is do as following.
upArrow.addEventListener(MouseEvent.MOUSE_DOWN,upA rrowMouseDown);
upArrow.addEventListener(MouseEvent.MOUSE_UP,upArr owMouseUp);
downArrow.addEventListener(MouseEvent.MOUSE_DOWN,d ownArrowMouseDown);
downArrow.addEventListener(MouseEvent.MOUSE_UP,dow nArrowMouseUp);
private function upArrowMouseDown(e:MouseEvent){
//adding event listener on stage
stage.addEventListener(MouseEvent.MOUSE_UP,upArrow MouseUp);
//your logic comes here.
}
private function upArrowMouseUp(e:MouseEvent){
//removing listener from stage.
stage.removeEventListener(MouseEvent.MOUSE_UP,upAr rowMouseUp);
//your logic comes here
}
private function downArrowMouseDown(e:MouseEvent){
//adding event listener on stage
stage.addEventListener(MouseEvent.MOUSE_UP,downArr owMouseUp);
//your logic comes here.
}
private function downArrowMouseUp(e:MouseEvent){
//removing listener from stage.
stage.removeEventListener(MouseEvent.MOUSE_UP,down ArrowMouseUp);
//your logic comes here
}
I hope you are comfortable with idea now.
Regards,
M Uzair Arshad
CEO & Founder.
http://www.emblemtechnologies.com
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.