3 Replies Latest reply on Apr 18, 2007 3:04 PM by kglad

    MovieClipLoader problem - Newbie

    DigTunes
      Hello,
      I am trying to load different external swf files into a loader Movie Clip in my main program. For example, I have main.swf, bio.swf, and help.swf, and I'm trying to load them when a button is pressed in my main timeline. This is what I did:
      I created a new empty Movie Clip with an instance name of 'loader_mc' in my main project.
      Then in the actions layer of my main project I put the following code:

      var myMCL:MovieClipLoader = new MovieClipLoader();
      var myLoadListener:Object = new Object();

      myLoadListener.onLoadStart(loader_mc):Void{
      myProgressBar._visible = true;
      }
      myLoadListener.onLoadComplete(loader_mc):Void{
      myProgressBar._visible = false;
      }
      mainButton.onPress = function():Void{
      myMCL.loadClip("main.swf", loader_mc);
      }
      myMCL.addListener(myLoadListener);


      For some reason, this code is not working, and I'm not sure why. When I test the movie, I get this error message:

      **Error** Scene=Scene 1, layer=actions, frame=1:Line 4: Syntax error.
      myLoadListener.onLoadStart(loader_mc):Void{

      **Error** Scene=Scene 1, layer=Main loader, frame=1:Line 1: Statement must appear within on/onClipEvent handler
      var myMCL:MovieClipLoader = new MovieClipLoader();

      **Error** Scene=Scene 1, layer=Main loader, frame=1:Line 2: Statement must appear within on/onClipEvent handler
      var myLoadListener:Object = new Object();

      **Error** Scene=Scene 1, layer=Main loader, frame=1:Line 4: Syntax error.
      myLoadListener.onLoadStart():Void{

      Total ActionScript Errors: 4 Reported Errors: 4

      Sorry for the long post, but I am at my wits end trying to figure this one out.
      By the way, I am using Flash MX2004 with AS 2.0, if that makes any difference.

      Many thanks to the kind soul who takes pity on me and can help out!!

      Best -
      DigTunes
        • 1. Re: MovieClipLoader problem - Newbie
          kglad Adobe Community Professional & MVP
          those should be:

          • 2. Re: MovieClipLoader problem - Newbie
            DigTunes Level 1
            Many thanks for that, kglad! I'm almost there. Now my progress bar doesn't seem to be working properly, even when I "simulate download" in the test movie. Here's what I have (with your help):

            var myMCL:MovieClipLoader = new MovieClipLoader();
            var myLoadListener:Object = new Object();

            myLoadListener.onLoadStart = function(myLoader):Void{
            myProgressBar._visible = true;
            }
            myLoadListener.onLoadInit = function(myLoader):Void{
            myProgressBar._visible = false;
            }
            mainButton.onPress = function():Void{
            myMCL.loadClip('myMain.swf', myLoader);
            }
            myMCL.addListener(myLoadListener);


            I'm using a customized Progress Bar component from the standard Library with an instance name of 'myProgressBar'. The bar shows up when I press the button, but doesn't move, then it disappears when the ext swf loads.

            Many thanks!! :-)
            DigTunes
            • 3. Re: MovieClipLoader problem - Newbie
              kglad Adobe Community Professional & MVP
              you need to use an onLoadProgress method of you mcl listener. check its parameters in the help files and apply them to your progress bar.