LibraryProxy is a library for loading an external SWF and fetching objects from it using linkagename. This lib allows the load of external assets avoiding the use of embedded resources. The SWF format is also a commonly used export form for assets by artists, which helps the interoperation of different teams.

The library is able to handle the SWF loading process, informing the progress and, after it is done, resources can be fetched by name and type, such as getMovieClipById() for MovieClips. In order to be loaded, the main class of the SWF must implement a specific interface defined by LibraryProxy.


// The main class of the SWF to be loaded
public class Main extends Sprite implements ILibrarySubscriber {}

// In the application:
private function load():void {

public function libraryEvent(e:Event):void {
        switch(e.type) {
                case Event.COMPLETE:
                    //Library loaded
                    var mc:MovieClip = LibraryProxy.getMovieClipById("linkagename");
                    var bd:BitmapData = LibraryProxy.getBitmapDataById("linkagename");
                    var b:Bitmap = LibraryProxy.getBitmapById("linkagename");
                    var sp:Sprite = LibraryProxy.getSpriteById("linkagename");
                    var so:Sound = LibraryProxy.getSoundById("linkagename");
                case ProgressEvent.PROGRESS:
                    //Loading progress
                case IOErrorEvent.IO_ERROR:
                    //Handle Errors
Loaders. URL.