Way to link an swc externally
I have created a flex application and I want to use a third party library (swc) in such a way that
Basically, I want to have an optional dynamic(runtime) linking to a locally stored swc at user end. If the swc is available, my swf should be able to use it else it doesn't have to.
Is it possible?
I'm not sure about SWC but this is how I do it with SWF. Please note I'm copying code from different parts so you may need to fine tune it
var the_cls:Class;
// First, load SWF with classes:
var request:URLRequest = new URLRequest( u );
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, function (e:Event){
// then get class from the file, you can do it for few classes
the_cls = e.target.applicationDomain.getDefinition("my_ldd_class_name") as Class;
});
loader.load(request, new LoaderContext(false, ApplicationDomain.currentDomain));
// then use class in your application:
the_obj = new the_cls();
the_obj.the_func();
链接地址: http://www.djcxy.com/p/35442.html
上一篇: 输出文件中缺少外观?
下一篇: 从外部链接swc的方法