Since Flex Builder beta for Mac was released on labs I’ve been using it for my Flex work. It was a week into using the Mac beta that I wrote this post after finding a new events had been added to DisplayObjects that gets dispatched when an object is added to and removed from the stage. For some reason I didn’t publish it then (yeah my blogs been quiet), but the docs haven’t been updated so I thought it was still worth mentioning.
Event.ADDED_TO_STAGE only gets dispatched once an object has been added to a displayList, and also all its parents have been added.
Event.REMOVED_FROM_STAGE is dispatched when a DisplayObject, or any of its parents are removed from the display list.
These events are really useful, as before we could only use Event.ADDED and Event.REMOVED.
Event.ADDED gets dispatched when a DisplayObject is added to a display list, but it doesn’t mean it has been added to the stage, as its parent, or parents parent etc. might not have been added.
Event.REMOVED gets dispatched when a DisplayObject is removed from the display list, but if it’s parent or parents parent etc. was removed we wouldn’t have known.
Previous to this < href="http://www.senocular.com/">Senocular had a nice stage detection script that you can use if your not targeting the latest version of the Flash player (9.0.28.0).
Some events for when Scrollbars are added to containers would now be useful!