I am a long-time user of ActionScript 2, now I'm starting with ActionScript 3. The only thing I miss is an easy way to duplicate the functionality of AS2 MovieClip.onReleaseOutside. It is almost always necessary to implement this event, otherwise you will get funny errors, as the flash thinks that your mouse does not work when it really is.
According to the AS2 to AS3 Migration Guide , I have to use flash.display.InteractiveObject.setCapture() for this, however it does not exist as far as I can tell. I assume this document is outdated or incorrect. I found several posts on the Internet on how to duplicate this functionality, but they either have their own problems:
- This one triggers onReleaseOutside, even if there was no corresponding onPress event.
- This option seems very inefficient, you will add and remove an event listener every time the mouse is clicked anywhere in your application.
There should be an easier way, donβt tell me that Adobe forgot about this when rewriting ActionScript?
Sample AS2 code:
// Assume myMC is a simple square or something on the stage myMC.onPress = function() { this._rotation = 45; } myMC.onRelease = myMC.onReleaseOutside = function() { this._rotation = 0; }
Without the onReleaseOutside handler, if you clicked on squre, dragged the mouse out of it and released the mouse, then the square will not rotate and seems to be stuck.
source share