How to build and use a Flash DLL

As flash dll technic is widely used from AS2 time, now AS3 time, we use it widely too, we don’t like RSL since it can’t controlled by pure AS code.
Here a quick introduction for how to build and use a flash dll:

1. Build a Flash DLL
For a library project, such as AsWing, build it’s DLL is very simple: Create a ActionScript Project with only one simplest class:

class AsWingDLL extends Sprite{
//do nothing
}
And add a compiler argument for your flex compiler : -include-libraries path to the AsWing.swc , then build this project, the output swf is a regular flash DLL now.
Note: The AsWingDLL class is the entry class, it is just for make loader’s onComplete/onInit event will be fired, then compiler argument -include-libraries is to force all the classes in AsWing.swc will be compiled into the output swf.

For a ActionScript Project, the output swf is already a DLL, you just should take care to know what classes were compiled into the swf.

Then:

2. Use a Flash DLL
Well, then, how to use a Flash DLL, in essence, Flash DLL is just like a file that contains compiled classes, so generally, we load it first, the classes is available to use when it is load completed.

You can check this example: www.flashdll.org

Note: The convenience is that you can use the classes and with -external compiler argument to build your main project, above example shows that you can use AsWing in that application, but you don’t need to compile AsWing classes into the main swf, you can load AsWingDLL separately first, and then execute your code which used AsWing. It will runs well.

And, if you have more than one FLL, make sure your DLL’s load order, the most based DLL should load first.

For complex use, you can read the document of Loader and LoaderContext and especially the ApplicationDomain .

Tags: DLL

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值