<?xml version=”1.0″ encoding=”utf-8″?> <mx:Application xmlns:mx=” http://www.adobe.com/2006/mxml ” xmlns=”*” backgroundColor=”white”> <mx:Script> <![CDATA[ public function createBarsToo():void { myHBox.addChild(new CustomComponent()); } ]]> </mx:Script> <mx:HBox id=”myHBox” horizontalGap=”3″ backgroundColor=”red” width=”150″ height=”50″/> <mx:Button id=”myButtonToo” click=”createBarsToo()” label=”Create Component”/> </mx:Application> CustomComponent.mxml <?xml version=”1.0″ encoding=”utf-8″?> <mx:Canvas xmlns:mx=” http://www.adobe.com/2006/mxml ” xmlns=”*” backgroundColor=”blue” cornerRadius=”5″ width=”10″ borderStyle=”inset” height=”50″/> |