onReleaseOutside in ActionScript 3

It’s always strange to find out that something you thought was so basic in a previous version disappears in the next version. Well, that’s what happened with the onReleaseOutside event function from ActionScript 2. That is actually not a bad thing because I used it mostly with buttons so that they wouldn’t stay in the down state or over state when you released outside. In ActionScript 3, as soon as you leave a button (or MovieClip or Sprite) it fires the MOUSE_OUT event so you don’t really have to watch for the onReleaseOutside event like you used too.

Where you still need the onReleaseOutside event is when you drag an object like the thumb of a scrollbar because you have to know when to stop the drag. The trick is to use a MOUSE_DOWN event from the object you want to drag to start you dragging process and to use the MOUSE_UP event from the stage (this isĀ  the trick). It doesn’t really matter to use the event from the stage because the MOUSE_UP event is nearly never used and you remove the listener after it has fired to free memory. I’ll post source code about it tomorrow.

,

  1. No comments yet.
(will not be published)
Subscribe to comments feed
  1. No trackbacks yet.