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.
Sample
// The main class of the SWF to be loaded public class Main extends Sprite implements ILibrarySubscriber {} // In the application: private function load():void { LibraryProxy.loadLibrary("lib/library.swf"); } 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"); break; case ProgressEvent.PROGRESS: //Loading progress break; case IOErrorEvent.IO_ERROR: //Handle Errors break; } }
RT @as3gamegears: New: LibraryProxy (lib to load external SWFs and fetch objects from it using linkagename) http://t.co/NTo1Ep4urd #as3 #fl…