Thursday, August 26, 2010

Dynamically adding MXML components to the application

A few days ago, a question regarding MXML components was raised at the Flashoo forum.
The question was how can we add an MXML component defined in the project, at runtime, 
by its name. The name is build dynamically as well. When I tried to do so - I found that it is a 
bit more complex than it looks. The reason is that the Flex Linker and Compiler do not include
such components in the output SWF since there is no reference to them in the code.
The solution is to include a reference variable for each component, even though it is not really
used. Check out this little example. You can find the source code here.


About Me

My photo
I've been developing Internet and rich-media application for 15 years. In my work I emphasis usability and best user experience as well as sleek design. My main expertise are JavaScript, Flex and Flash.

Followers