Flash DLL

reduce your swf size over 90%

10rd Mar-2008 updated

 

Example 1 use FastLoad:


Place FastLoad.swf on your site, and modify the dlls.xml file to fit your set. For example:
	<DLLs>
		<DLL path="http://www.flashdll.org/AsWingDLL_1_1_0.swf" name="AsWing 1.1" />
		<DLL path="FastLoadDemoApp.swf" name="FastLoad Example" execute="main"/>
	</DLLs>
The FastLoad.swf will load dlls.xml first, and then load the dll swfs one by one, if there's execute attribute set, when it is loaded, the specified method will be called with a param -- rootDisplay:DisplayObjectContainer, then your execute method can add your application assets to that root container.

dlls.xml can be a url param passed to FastLoad.swf too, like this way : http://www.flashdll.org/FastLoad_debug.swf?dlls=%3CDLLs%3E%3CDLL%20path%3D%27http%3A%2F%2Fwww%2Eflashdll%2Eorg%2FAsWingDLL%5F1%5F1%5F0%2Eswf%27%20name%3D%27AsWing%201%2E1%27%20%2F%3E%3CDLL%20path%3D%27http%3A%2F%2Fdemo%2Easwing%2Eorg%2FFastLoadDemoApp%2Eswf%27%20name%3D%27FastLoad%20Example%27%20execute%3D%27main%27%2F%3E%3C%2FDLLs%3E The dlls param is:

	<DLLs>
		<DLL path="http://www.flashdll.org/AsWingDLL_1_1_0.swf" name="AsWing 1.1" />
		<DLL path="http://demo.aswing.org/FastLoadDemoApp.swf" name="FastLoad Example" execute="main"/>
	</DLLs>

Example 2 use DLLLoader directly:


package {
    import flash.display.Sprite;
    import flash.events.Event;

    import org.aswing.AsWingManager;
    import org.aswing.JFrame;
    import org.flashdll.DLLLoader;
    import org.flashdll.DLLLoaderUI;

    [SWF (width=800, height=600)]
    public class FlashDLlTest extends Sprite
    {
        public function FlashDLlTest()
        {
            var loader:DLLLoader = new DLLLoader();
            loader.addEventListener(DLLLoader.ALL_COMPLETED, this.init);

            var ui:DLLLoaderUI = new DLLLoaderUI(this, loader);

            loader.addDLL("http://www.flashdll.org/AsWingDLL_1_1_0.swf", "AsWing A3 1.0");

            loader.notify();
        }

        protected function init(e:Event) :void {
            AsWingManager.initAsStandard(this);

            var frame:JFrame = new JFrame(this);
            frame.setSizeWH(400, 300);
            frame.show();
        }
    }
}

When compile, set Link type of AsWing.swc as "External", then take a look at you swf, less than 5kb. Before, it's about 100kb


You can get FlashDLL project at http://code.google.com/p/flashdll

Totorials

Demos

How to build your DLL? check this tutorial : http://www.aswing.org/?p=214

Here are the DLLs already laied on flashdll.org

Dlls
Name Version URL Project homesite
AsWing 1.1.0 http://www.flashdll.org/AsWingDLL_1_1_0.swf http://www.aswing.org
AsWing 1.3.0 http://www.flashdll.org/AsWingDLL_1_3_0.swf http://www.aswing.org