1 Reply Latest reply on Jan 5, 2011 1:16 PM by Ned Murphy

    Why are 2 loadNext functions allowed in my script?

    Cuwen_26 Level 1

      Hello.  I'm pasting my entire code right now.  I have two functions that use loadNext.  How can I have that?  I don't quite understand it and would greatly appreciate help.  I'm bolding the two areas that use the loadNext function.

       

      I give "Correct Answer" when I am helped and "Helpful Answer" if the answer simply helps me along.

       

       

          var currentSwf:Number = 0;
          var swfs:Array = new Array("EZSmartStand/SmartStand.swf", "EZSmartStand/Warnings.swf", "EZSmartStand/LCDDisplay.swf", "EZSmartStand/Operation.swf", "EZSmartStand/Harness.swf", "EZSmartStand/Transferring.swf", "EZSmartStand/800lbvid.swf", "EZSmartStand/Ambulating.swf", "EZSmartStand/Accessories.swf", "EZSmartStand/HarnessLaundering.swf", "EZSmartStand/ChargingBatteries.swf", "EZSmartStand/EmergencyLowering.swf", "EZSmartStand/EmergencyLowering2.swf");

          var listener:Object = new Object();
          var mcl:MovieClipLoader = new MovieClipLoader();
          mcl.addListener(listener);

             // When the swf loads, set it up to constantly check its current frame
          // against the total frames, and if those match, the swf is done playing.
          // If that's the case, then load the next one.

          listener.onLoadInit = function(targ:MovieClip):Void {
             theTargetClip_mc.onEnterFrame = function():Void {
                if (this._currentframe == this._totalframes) {
                   loadNext();
                   delete this.onEnterFrame;

                }
             }
          }


      //Previous and Next Swf Button

      function loadNext():Void {
          currentSwf++;
          if (currentSwf >= swfs.length) currentSwf = 0;
          loadSWF(currentSwf);
      }




      function loadSWF(nextSWFToLoad){
         mcl.loadClip(swfs[nextSWFToLoad],theTargetClip_mc);
      }

      loadSWF(currentSwf);


      function loadPrevious():Void{
         currentSwf--;
         if(currentSwf==-1) currentSwf = swfs.length-1;
         loadSWF(currentSwf);
      }


      previous_btn.onRelease = loadPrevious;
      next_btn.onRelease = loadNext;

       

      //End Previous and Next Swf Button


      //Play Button

      play_btn.onRelease = function() {
          theTargetClip_mc.play();
      }

      //Pause Button

      pause_btn.onRelease = function() {
          theTargetClip_mc.stop();
      }