2 Replies Latest reply on Jun 8, 2006 5:58 PM by Newsgroup_User

    help with error msg

    Level 7
      The following code throws an error (Attribute used outside class) on
      line 3 and 4. What have I done wrong?

      Can you see any other problems with this code / approach??
      (the goal is to load a number of swf's into movie clips and then show
      them one after the other)

      Steve

      -------------------------------
      AS in frame 1 of main SWF:
      if (init == undefined) {
      var aSWFs:Array = new Array("an1.swf", "an2.swf", "an3.swf");
      public nSWFs:Number = aSWFs.length;
      public nCurSWF:Number = 0;
      public aSWFmcs:Array = new Array();
      for (var n=0; n<=nSWFs; n++) {
      aSWFmcs.push(createEmptyMovieClip("swf"+n, n));
      }
      var mcl:MovieClipLoader = new MovieClipLoader();
      var Listen:Object = new Object();
      Listen.onLoadInit = function() {
      if (nCurSWF <= nSWFs) {
      nCurSWF++;
      // load the next swf
      mcl.loadClip(this.aSWFs[nCurSWF], aSWFmcs[nCurSWF]);
      trace("loading " + this.aSWFs[nCurSWF]);
      } else {
      // done loading... start playing
      aSWFmcs[0].gotoAndPlay(2);
      }
      }
      mcl.addListener(Listen);
      mcl.loadClip(this.aSWFs[0], aSWFmcs[0]);

      init = 1;
      }

      ------------------------------------
      AS in frame 1 of each SWF:
      stop():

      AS in last frame of each SWF:
      stop();
      // if the Current SWF is not the last increment nCurSWF, else set it to
      the start
      if (nCurSWF < nSWFs) {
      nCurSWF++;
      } else {
      nCurSWF = 0;
      }
      aSWFs[nCurSWF].gotoAndPlay(2);
        • 1. Re: help with error msg
          NSurveyor Level 2
          You shouldn't be using public, that's for class stuffs. Use var in replace of public to make local variables,
          • 2. Re: help with error msg
            Level 7
            In article <e6afb6$dk2$1@forums.macromedia.com>, saif7463@yahoo.com
            says...
            > You shouldn't be using public, that's for class stuffs. Use var in replace of public to make local variables,
            >
            Thought I'd need the public declaration to make those variables visible
            to the loaded swf's??

            OK, took out the publics, made then vars and I get a blank stage... no
            progression of swf's

            here's the code as modified... I put in a trace in the Listener and only
            the first swf is loading??

            -------------------------------
            AS in frame 1 of main SWF:
            if (init == undefined) {
            var aSWFs:Array = new Array("an1.swf", "an2.swf", "an3.swf");
            var nSWFs:Number = aSWFs.length;
            var nCurSWF:Number = 0;
            var aSWFmcs:Array = new Array();
            for (var n=0; n<=nSWFs; n++) {
            aSWFmcs.push(createEmptyMovieClip("swf"+n, n));
            }
            var mcl:MovieClipLoader = new MovieClipLoader();
            var Listen:Object = new Object();
            Listen.onLoadInit = function() {
            if (nCurSWF <= nSWFs) {
            nCurSWF++;
            // load the next swf
            mcl.loadClip(this.aSWFs[nCurSWF], aSWFmcs[nCurSWF]);
            } else {
            // done loading... start playing
            aSWFmcs[0].gotoAndPlay(2);
            }
            }
            mcl.addListener(Listen);
            mcl.loadClip(this.aSWFs[0], aSWFmcs[0]);

            init = 1;
            }

            ------------------------------------
            AS in frame 1 of each SWF:
            stop():

            AS in last frame of each SWF:
            stop();
            // if the Current SWF is not the last increment nCurSWF, else set it to
            the start
            if (nCurSWF < nSWFs) {
            nCurSWF++;
            } else {
            nCurSWF = 0;
            }
            aSWFs[nCurSWF].gotoAndPlay(2);