Apollo Alpha 1 Documentation - collected by Jimbob | Back to MY RESOURCES


Wrapping an HTMLControl in a UIComponent

To add an HTMLControl object to a Flex container, you must wrap the object in a UIComponent. You can do this by extending the UIComponent with a custom class that includes an HTMLControl as a member.

If you do not need to add functionality, a simpler method is to add a UIComponent to the Flex container, and then add the HTMLControl to the UIComponent. This works because you can add a Sprite object to a UIComponent and the HTMLControl extends Sprite.

Example

var htmlView:HTMLControl = new HTMLControl();
htmlView.width = 500;
htmlView.height = 500;

//Create the wrapper object
var wrapper:UIComponent = new UIComponent();

//add the HTMLControl to the wrapper
wrapper.addChild(htmlView);

//add the wrapper to a Flex container object, such as ApolloApplication
this.addChild(wrapper);

Back


collected by Jimbob 2007.05