7 Replies Latest reply on Feb 16, 2011 3:50 PM by Nellie Mullins

    External Preloader, percent text of load not working w/actionscript 3

    Nellie Mullins

      I've been searching to find a simple answer to external preloaders, but it seems there are many ways to accomplish this with ac3.

      I am new to as3 and this is what I've come up with so far:


      green_mc.scaleX = 0;
      black_mc.scaleX = 0;
      var loader = new Loader();
      loader.load(new URLRequest("zibapistachiointeractivesmfilesize03.swf"));
      loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
      loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressHandler);

      var total:Number = loaderInfo.bytesTotal;
      var loaded:Number = loaderInfo.bytesLoaded;
      percent.text = Math.floor((loaded/total)*100)+ "%";

      function onCompleteHandler(e:Event):void {
      green_mc.visible = false;
      black_mc.visible = false;
      function progressHandler(e:ProgressEvent):void {
      var per = e.bytesLoaded/e.bytesTotal;
      green_mc.scaleX = per;
      black_mc.scaleX = per;
      loader.visible = true;


      Everything else is working except my dynamic text that should also be calculating the % of loading.


      If anyone on this forum can help me, I would really appreciate it.  It's been a couple of days searching to get this external preloader to work correctly.


      Thank you