Home > Articles > Web Development

  • Print
  • + Share This
This chapter is from the book

IMXMLObject

Having the component framework is well and good, but what if you want to base your components on something else and build the functionality from the ground up? In ActionScript, that isn't an issue, just a lot of work. For MXML components, it can be the equivalent of a brick wall. Luckily, that's where IMXMLObject comes in. This is an interface that you implement within your MXML component to allow pure MXML components to be created without subclassing from UIComponent. Like the majority of interfaces, you also need to implement the functions that are defined within it. In the case of IMXMLObject, there is only one: initialized().

I suspect you are now thinking, "Why would I want to create a component that doesn't inherit from the component framework and is in MXML?" Well, you may want to make a lightweight component that has only a specific function—the component frameworks do add in a lot of stuff that you may not necessarily want in your component. Or you may want to make some form of repository that is quicker to create in MXML as opposed to ActionScript. In the majority of component cases, you won't need to use this approach because you are more likely to extend your components from UIComponent and its subclasses or your own components that are derived from either the Halo or Spark component frameworks. However, for completeness, it is beneficial to know that it is there if you require that level of control in an MXML-based component.

The last aspect of the component framework is a unique form of component, even for Flex. These are the template components, and they provide a useful purpose when creating components that can contain other components defined at author time by a developer; think about all the container components, for example.

  • + Share This
  • 🔖 Save To Your Account