April 12, 2008 | Posted in: ActionScript 3,Code,Flash by Quentin

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.

Comments
  1. Ben
    April 19, 2008 | 9:02 am

    Loving your commenting markup. So important!

  2. Brendan
    July 11, 2008 | 4:36 am

    Hey there, I absolutely love coda, any ideas for setting it up for as3?

  3. Quentin
    July 11, 2008 | 9:41 am

    Hey Brendan,

    Actually, the way I work with Coda is by simply setting up “clips” for the code that I use most. So basically, I have a clip which serves as a template which adds 1) typical information at the top such as class name, developer name, my company name and year, etc. 2) package and class constructor information 3) the methods that remain consistent throughout most of my classes. As for the new AS3 syntax being incorporated, I actually plan to contact the guys at Panic to see if they have plans to add it in the next or an upcoming update. Be nice to see prooper syntax coloring for AS3.

  4. freemind
    August 27, 2008 | 12:00 pm

    interesting approach how you use the coda ‘clips’ ;)
    would be excellent if you could write a short article about your as-workflow with coda…

    keep up the good work!

  5. randygland
    January 13, 2009 | 8:56 am

    your code zip file is a missing link

  6. Quentin
    January 13, 2009 | 9:11 am

    Link to the as3 zip file has been fixed. Thanks for the heads up Randy!

Leave a comment

You must be logged in to post a comment.