Introducing Building a Component with ActionScript 3.0

In an earlier lesson you learned that any code written in MXML is first translated into ActionScript, before being compiled into a SWF file. In reality, every Flex component that exists is an ActionScript class, regardless of whether it's a UI control, a Container, or some other type of component. Anything you might create in MXML can also be created in ActionScript, and there are things you can do with ActionScript that are not available purely from MXML. This makes it possible to create custom components either in MXML, as you explored in Lesson 7, or you can develop more advanced components purely in ActionScript 3.0, as you will learn in this lesson.

The steps you will take in creating an ActionScript 3.0 component are very similar to the steps you take for building any ActionScript 3.0 class. First, determine what (if any) superclass your new class will extend. Then determine what properties you will need to declare for your class. Next, determine any new methods you might need to implement. You will also need to declare any events your component will dispatch. If your component is a visual class, you will likely need to override createChildren() and updateDisplayList() because they are the methods that Flex components use to create and lay out any child elements of the components.

Adobe Flex 2.Training from the Source
Adobe Flex 2: Training from the Source
ISBN: 032142316X
EAN: 2147483647
Year: 2006
Pages: 225 © 2008-2017.
If you may any questions please contact us: