AS3 onReleaseOutside equivalent…

This is quite a common question for those looking to migrate from Actionscript 2.

As with most things in AS3 it initially seems odd, but after working with it you quickly see the thought process behind it.

Like AS2 you attach your standard Button style events to your object, MOUSE_DOWN, MOUSE_UP, MOUSE_OVER, MOUSE_OUT. But you attach the onReleaseOutside equivalent to the Stage and not the object.

i.e. –  stage.addEventListener(MouseEvent.MOUSE_UP,yourButtonReleaseFunction);

The stage then dispatches this event anytime the user releases the mouse button over the flash movie. Team that up with an Event.MOUSE_LEAVE to check if the mouse leaves the flash movie and you’re good to go.

Here’s a simple AS Slider example :

Leave a Reply

Your email address will not be published. Required fields are marked *