先实例化一个UIComponent,然后将swc加到UIComponent里面,然后其他再加载UIComponent就行了<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="test()" layout="absolute" xmlns:myPanel="*">
<mx:Script>
<![CDATA[
import mx.core.UIComponent;
private function test():void{
var a:step = new step();
var ui:UIComponent = new UIComponent();
ui.addChild(a);
this.mypanel.addChild(ui);
}
]]>
</mx:Script>
<myPanel:MyPanel id="mypanel" width="400" height="200"/>
</mx:Application>
|