如何加载一个swf文件中类的方法
为了取某个类而去加载swf资源包。请查flex4 api getDefinition()
/**
* 为获取某个类,去加载SWF
* 如果意见加载了,发送加载成功事件
*
* */
public function getClassByLoadSWF(swfPath:String,className:String):void{
var isNeedLoadFlag:Boolean = false;
try{
var ClassName:Class = ApplicationDomain.currentDomain.getDefinition(className) as Class;
}catch(e:Error){
isNeedLoadFlag = true;
}
if(ClassName != null || isNeedLoadFlag ){
loadSwf4Class(swfPath,className);
addEventListener(LibraryLoader.LOADCOMPLETE_EVENT,onLoadCompleteFun);
}else{
SWFClassName = ClassName;
dispatchEvent(new Event(LibraryLoader.CLASSLOADCOMPLETE_EVENT));
}
}