在某些情况下需要通过配置文件来获取类名进而进行实例化。
flex can't complie the class into swf file, then runtime error will occur,I don't know whether there is some solution
var obj:Object = getDefinitionByName("GCComponent.MyTestComponent") ; //as Class;
var ClassReference:Class = obj as Class;
var ins:Object = new ClassReference();
ins.width = 100;
ins.height = 10;
ins.x = 0;
ins.y = 0;
this.addChild(ins as UIComponent);
}
]]>
flex can't complie the class into swf file, then runtime error will occur,I don't know whether there is some solution
var obj:Object = getDefinitionByName("GCComponent.MyTestComponent") ; //as Class;
var ClassReference:Class = obj as Class;
var ins:Object = new ClassReference();
ins.width = 100;
ins.height = 10;
ins.x = 0;
ins.y = 0;
this.addChild(ins as UIComponent);
}
]]>