Journey into Actionscript 3.0

Written by cam | April 11th, 2008 | articles

I recently began to explore the world of ActionScript 3.0, which has helped me to further develop a new, more object oriented approach to developing flash applications.

I began my journey with a fabulous tutorial called ‘ActionScript 3.0 – Beyond the Basics’. I have done quite a bit of research into AS3 and how it differs from the previous version of the language, and I also studied up on my object oriented programming. By the time I began this tutorial I had a pretty solid understanding of how the language should look and operate. The tutorial took my skills to the next level though, helping me develop clips and components which I had already developed in AS2 in the new language and also in a largely class based OOP way. Menu systems, interfaces and particle generators were all on the menu of this excellent tutorial.

The tutorial took me about 2 solid weekends of coding to work through and fully understand, and I can honestly say that it was an excellent starting point for me to begin to develop a new library of AS3 classes and components. This is where generating my own AS3 code library began, developing simple components. I decided to begin by creating the building blocks of any website in a class based system, so that from now on creating an entire interface will be as simple as a few lines of code. I started with a basic menu system, quickly moving on to developing more complex navigation systems such as dropdown and accordion menus, then moved on to other interface elements such as photo galleries and custom scroll panes.

When developing all these components I knew that I would want all of them to be extremely expandable and re-usable, so making them class based was a must. For most components I realized that XML would be the universal language that they would use to generate the content, so all components are self-generated by simply passing the component a piece of XML to read. For example, the menu system below is created with only 4 lines of code:

import lift.interactive.DropDownMenu;
var dropMenu:DropDownMenu = new DropDownMenu();

By creating a simple class based menu system I was able to easily build on it to develop more complicated menu systems like the one above. This is one aspect of AS3 that I am really starting to enjoy, the ability to re-use code and create rich applications with very little code. Of course there is quite a bit of code that runs behind the scenes, but the idea is that you very rarely have to alter it, making AS3 a very powerful language.

More to come as I delve deeper into the world of AS3!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.