队列加载类 BulkLoader的使用
下载地址 http://code.google.com/p/bulk-loader/
public class TestBulkLoader extends Sprite { private var loader:BulkLoader; public function TestBulkLoader() { stage.scaleMode = StageScaleMode.NO_SCALE; stage.align = StageAlign.TOP_LEFT; loader = new BulkLoader("main-site"); loader.logLevel = BulkLoader.LOG_INFO; var ctx:LoaderContext = new LoaderContext(); ctx.applicationDomain = ApplicationDomain.currentDomain; loader.add("assets/ui.swf",{"context":ctx,"id":"ui"}); loader.add("assets/a.jpg",{id:"image"}); loader.add("assets/npc.xml",{priority:20, id:"config-xml"}); loader.addEventListener(BulkProgressEvent.COMPLETE,onAllItemsLoaded); loader.addEventListener(BulkProgressEvent.PROGRESS,onAllItemsProgress); loader.start(); } protected function onAllItemsProgress(event:BulkProgressEvent):void { //trace(event.loadingStatus()); } protected function onAllItemsLoaded(event:BulkProgressEvent):void { loader.removeEventListener(BulkLoader.COMPLETE, onAllItemsLoaded); loader.removeEventListener(BulkLoader.PROGRESS, onAllItemsProgress); trace("all souce loaded!"); var bitmap:Bitmap = loader.getBitmap("assets/a.jpg"); addChild(bitmap); var bitmap2:Bitmap = loader.getBitmap("image"); addChild(bitmap2); bitmap2.x = 50; bitmap2.y = 0; var xml:XML = loader.getXML("config-xml"); //获得swf里的连接名字 var b:Class = ImageItem(loader.get("ui")).getDefinitionByName("ui.cishabtn.up") as Class; addChild(new Bitmap(new b() as BitmapData)); loader.clear(); loader = null; } }