AS3 onReleaseOutside equivalent…
Wednesday, August 27th, 2008 | Actionscript 3
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 :
No comments yet.
Leave a comment
Search
Recent Posts
Categories
@AdenForshaw
- On the train back from london, sat next to a portly chap wearing double denim rocking a pungent aroma of Eu de sweaty man. #BadTimes
- Presenting new @Coull Affiliator in #Cocoon lounge bar Picadilly. Only snag is it's soft drinks only... torture!
- The old boys rockin it hard over at the #OldDuke http://twitpic.com/1mrsn2
- Strong set from #GazBrookfield over at Mr Wolfs, shame about the cider selection.
- Doing the pub quiz over at #theorchard , the questions are pretty hardcore tonight http://twitpic.com/1l1uf1