As I mentioned in my previous post, here are the files for the AS3 version of my Box class and its companions. For those of you who downloaded the AS2 version and are either curious about or transitioning into the realm of AS3, you’ll notice a pretty big difference in the way things are done. You’ll also notice that the code is much cleaner and a bit shorter. That’s because I was a bit less lazy with the formatting and since I use Coda for all of my dev work, I have templates set up for my AS2 & AS3 class files.
The other interesting thing you’ll notice is the difference in the way the box is drawn. AS3 adds the ability to draw a more complex rectangle which allows you to specify the ’roundness’ of each corner. To do this, you simple call ‘your_shape_name.graphics.drawRoundRectComplex’ and fill in the necessary parameters. So why is my class still needed, you ask? Well, for the most part, it’s still a nice and simplified way to create boxes with rounded corners and at the same time, apply a gradient and/or stroke to your shape and it still adds the scale9Grid for you, which automagically determines the largest rounded corner before applying. Download it and give it a try.
As well, If you haven’t already, I encourage you to download this cheat sheet which is extremely helpful in understanding the differences when moving from AS2 to AS3. As always, be sure to leave any questions, comments or suggestions.
