This is the most annoying point I have reached with AS3 yet. AS3 does not have an onReleaseOutside event, something I really needed for a menu to hide if the user clicked away from it. One implementation that I did find here involves a deeper understanding of the event bubbling mechanism. My own implementation is simpler and I just listen to a global application mouse click and see if my menu is down or not. However i do imagine lack of this event would make many developers go nuts. What sucks even more is that event isnt even available on the Flex framework. Maybe something we can ask for in 2.1 ?
Hi,
And here can we find your implementation?
Thanks.
LikeLike
@Luis:
The code is as simple as:
my_sprite.stage.addEventListener(MouseEvent.UP, doOnReleaseOutside)
Actually this is an old post and I recommend the one linked to the tip of the day post by sinocular.
LikeLike
arpit
my_sprite.stage.addEventListener(MouseEvent.UP, doOnReleaseOutside)
this will be invoked if the user does a click anywhere on the stage. What is to stop the user clicking on something that does not take a click, like a logo for example, that would fire your function.
LikeLike
@Neil
As long as the element clicked on does not capture the event, the mouse up event will bubble to the stage and the eventListener will be executed.
LikeLike
Thanks this solve. So simple, so useful.
I meet the problem today.
LikeLike