I’ll keep this short, but the Flash Player team gets a lot of requests for “convenience methods”, functions that save you time, typing, or calculation. Unfortunately, they can’t implement every one. But, while watching Colin Moock’s Lost ActionScript 3 Weekend (which I highly recommend you buy if you’re just starting out), Jim Corbett, primary author of the DisplayList API, answers the question of why certain convenience methods get implemented and others don’t. The example Colin Moock gave him was [sourcecode lang=”plain”]’displayObjectContainer.removeAllChildren()’[/sourcecode] …asking why it wasn’t chosen.

The answer is basically that it’s easy to write and only saves about 2 line of code. “Look at the ActionScript that’s involved”, Jim answered. ‘swapChildren’ however, is a much more complicated process. When you remove one displayObject from the DisplayList, the hierarchy collapses. Then, to complicate things, whether you go pull from the top or towards the bottom of the DisplayList factors into the calculation. It quickly becomes a conditional statement monster, and that’s the type of coding that people like Jim want to help us with by creating these convenience methods. Pretty interesting, huh? The video I mentioned is only available if you purchase the course, but, to whet your appetite, here is a 22 minute sample of the group’s talk with Jim.