1

Actionscript 3.0 Component Development

Over the past week or so I’ve been posting snippets on creating MXML based components, and will continue to do so. That said I thought I’d post some articles on creating components in Actionscript 3.0 so you can see where the crossover exists and provide information that will, hopefully, provide a rounded view on which method of development suits each individual.

As with my first post on component development with MXML I thought I’d take the same code but re-engineer it in to AS 3.0 code so we can see the difference.


So first of all let’s briefly review the MXML code of our extended ComboBox:

As you can see it ha all the elements you’d expect but how would we reproduce it in AS 3.0? Well first of all it would make sense to include the package path as this will have more relevance as we move on. So for the component above it is called FGComboBox.mxml and it is located in com.flashgen.components.flex.controls. When we just create the initial Actionscript 3.0 class you’ll see why this matter.

If you want to try it out here is the MXML application file:

placeholder for flash movieNow this is purely an example piece of code so it is unlikely you would really implement a component in this manner.

It will run and it has the same default values as the MXML version above it. The interesting thing to note is that once compiled you cannot tell the difference between the two versions. I know it is a very obvious thing to say but I thought I would be explicit.

Hopefully this has given a basis of comparison between the MXML and Actionscript 3.0 component development – albeit on the simple side.

Blatant Plug
Flash on the BeachCatch my talk on Flex 2 and Actionscript 3.0 component development at Flash on the Beach
December 4th-6th 2006, Brighton, UK

Mike Jones

One Comment

  1. Hey dude, The most interesting thing is the decision process that goes into deciding when to break something out into a component and how. No doubt so sort of “Best practice” will emerge.

Leave a Reply

Your email address will not be published. Required fields are marked *