Saturday, November 15, 2014

package loadSwf {


package loadSwf {  import flash.display.Loader;  import flash.display.Sprite;  import flash.events.Event;  import flash.events.IOErrorEvent;  import flash.events.ProgressEvent;  import flash.net.URLRequest;  import flash.system.ApplicationDomain;  import flash.system.LoaderContext;  import lirr schedule flash.utils.getDefinitionByName;   lirr schedule  public class Load extends Sprite  {   private var context:LoaderContext;   public function Load()   {    this.context = new LoaderContext();    this.context.applicationDomain = ApplicationDomain.currentDomain;        this.loaderSwfToLocal("Items.swf",loadSwfCompleteHandler,null);   }      private function lirr schedule loaderSwfToLocal({    var load:Loader = new Loader(); lirr schedule    load.contentLoaderInfo.addEventListener(Event.COMPLETE,callBack);
   load.load(new URLRequest(url),this.context);   }       private function loadSwfCompleteHandler(e:Event):void   {    e.target.removeEventListener(Event.COMPLETE,loadSwfCompleteHandler);    e.target.removeEventListener(ProgressEvent.PROGRESS,onProgress);     lirr schedule    var Items:Class = getDefinitionByName("Items") as Class;//全路径类名    var arr:Array lirr schedule = Items.items;    trace("数据长度 "+arr.length);   }       private function onProgress(e:ProgressEvent):void   {    try {     trace(e.bytesLoaded/e.bytesTotal*100+"%");         }catch(e:Error){     trace("onProgress =====>" + e);    }   }  } }
©2014 Baidu

No comments:

Post a Comment