3 Replies Latest reply on Apr 1, 2010 12:01 PM by kglad

    loading and unloading external swf?

    jreich9484

      I'm trying to load an external swf and unload it after its completion.  I have tried a few things and am stuck.  Here is my current code to loading the swf, which seems to be working fine, its the unload I cant get:

       

      import flash.net.URLRequest;

      import flash.display.Loader;

      import flash.events.Event;

      import flash.events.ProgressEvent;

       

      function startLoad()

      {

      var mLoader:Loader = new Loader();

      var request:URLRequest = new URLRequest("millerflash.swf");

      mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);

      mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);

      mLoader.load(request);

      }

       

      function onCompleteHandler(loadEvent:Event)

      {

              addChild(loadEvent.currentTarget.content);

      }

      function onProgressHandler(mProgress:ProgressEvent)

      {

      var percent:Number = mProgress.bytesLoaded/mProgress.bytesTotal;

      trace(percent);

      }

      startLoad();