0 Replies Latest reply on May 1, 2007 6:33 AM by realworks

    Dynamic smooth preloader help

    realworks
      Hello, I have two Preloaders that I use reguarly for diffrent reasons. One loads external clips and the other shows a loading bar that smoothly loads across the screen without jumping and stuttering.

      I'd like to combine the two but there no way I am fluent enought at ActionScript to do this!

      Below are the two preloader scripts. I hope someone can help make one great preloader!

      Thanks :)

      External Clip PreLoader:
      quote:


      stop();
      var myMCL:MovieClipLoader = new MovieClipLoader();
      var myListener:Object = new Object();
      myMCL.addListener(myListener);
      myListener.onLoadProgress = function(target_mc:MovieClip, bytesLoaded:Number, bytesTotal:Number) {
      var loaded:Number = Math.round((bytesLoaded/bytesTotal)*100);
      loader.gotoAndStop(loaded);
      };
      myListener.onLoadInit = function(target_mc:MovieClip) {
      loader._visible = false;
      play();
      };
      myListener.onLoadStart = function(target_mc:MovieClip) {
      attachMovie("loader", "loader", 2);
      };
      myMCL.loadClip("images/header/"+sect+"/"+file+".jpg", "art");



      Smooth scrolling loader:

      quote:


      function myWidth(moveObj, newWidth) {
      moveObj.w = moveObj._width;
      moveObj.dwidth = newWidth-moveObj.w;
      moveObj.t = 0;
      NFRAMES = 6;
      moveObj.onEnterFrame = function() {
      if (moveObj.t++<NFRAMES) {
      moveObj._width = easeOutQuad(moveObj.t, moveObj.w, moveObj.dwidth, NFRAMES);
      } else {
      delete this.onEnterFrame;
      }
      // end if
      };
      }
      // End of the function
      function myMove(moveObj, newX) {
      moveObj.x = moveObj._x;
      moveObj.dx = newX-moveObj.x;
      moveObj.t = 0;
      NFRAMES = 6;
      moveObj.onEnterFrame = function() {
      if (moveObj.t++<NFRAMES) {
      moveObj._x = easeOutQuad(moveObj.t, moveObj.x, moveObj.dx, NFRAMES);
      } else {
      delete this.onEnterFrame;
      }
      // end if
      };
      }
      // End of the function
      _root.getTotal = 200;
      ++_root.getBytes;
      percentLoaded = Math.round(_root.getBytes/_root.getTotal*100);
      this.myWidth(this.loadBar, percentLoaded*1.940000E+000);
      this.myMove(this.mc_loadNum, percentLoaded*1.900000E+000-8);
      mc_loadNum.loadNum.text = percentLoaded;
      easeOutQuad = function (time, beginX, changeX, durationX) {
      time = time/(durationX/2);
      if (time/(durationX/2)<1) {
      return (changeX/2*time*time+beginX);
      }
      // end if
      time = --time;
      return (-changeX/2*(--time*(time-2)-1)+beginX);
      };


      - Frame 2:
      quote:


      if (percentLoaded<100) {
      gotoAndPlay("preloading");
      }



      Thanks