AS3: Where is my onReleaseOutside

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 ?

  • Pingback: lessrain blog » Blog Archive » AS3 onReleaseOutside

  • Pingback: lessrain blog » Blog Archive » AS3 Button Engine revisited (onReleaseOutside)

  • Luis Filip Paço

    Hi,
    And here can we find your implementation?
    Thanks.

  • http://www.arpitonline.com arpit

    @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.

  • Neil

    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.

  • http://www.arpitonline.com arpit

    @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.

  • http://germo.silverbyte.hu Germo

    Thanks this solve. So simple, so useful.
    I meet the problem today.