6 Replies Latest reply on May 26, 2007 9:47 AM by TylerKiwi

    Return function once loadClip is complete.

    TylerKiwi
      Ok, I think this will prob. be simple for you AS experts out there, here's my code:
      [CODE]
      function loadPic(whichPic):Void {
      var i:Number = 0;
      var pic:String;

      var mcl:MovieClipLoader = new MovieClipLoader();
      var mclL:Object = new Object();

      mclL.onLoadProgress = function(target,loaded,total){
      trace("loading:"+total+"bytes");
      }

      mclL.onloadInit = function(){
      trace("finished loading");
      }
      mcl.addListener(mclL);

      switch (whichPic)
      {
      case "steam":
      pic = "flash/flashImage-stream.jpg";
      break;
      case "house2":
      pic = "flash/flashImage-house2.jpg";
      break;
      case "house3":
      pic = "flash/flashImage-house3.jpg";
      break;
      case "balcony":
      pic = "flash/flashImage-balconey.jpg";
      break;
      }

      mcl.loadClip(pic,mainImage);
      }
      [/CODE]
      What I want to do, is force the function to ONLY return once the file has finished loading. How can I do this??