2 Replies Latest reply on Jun 22, 2006 8:12 AM by andrew_dewdney

    Preloading external SWF's Help

    andrew_dewdney


      I'm currently designing this site: TheVenusGuns.com however I've run into the problem of larger SWF files taking longish times to load. I'm trying to find a preloader that externally loads the large SWF file. Hopefully this Preloader will open quickly so the viewer knows something is happening.

      I've found at website the offers a hand:
      Tutorialsite

      However the coding is crap! I've tried trouble shotting and working my way back through the Action script provided. My flash 8 output panel has found a few errors. Some which I've been able to fix myself.

      >>>>...............
      Progress Bar ActionScript

      You now have to add some code to the Loading bar Movie Clip. What this does is control the width of the bar. So that as more of the object loads the wider bar becomes. The bars width will match the percentage. If 50% has loaded then the bar will be 50 pixels wide etc.

      Select the Loading bar Movie Clip and add the following code (if you wish leave out the gray comments):


      // When the Flash Movie loads do the following...
      onClipEvent (load) {

      // Call the following function
      function follow(source, target, percent) {

      /* Set the variable vector equal to the percentage of the content being loaded and minus current width of this Movie Clip. */
      vector = (source-target);

      // Set the desp variable equal to the vector variable times by the percent which is the percentage loaded
      desp = (vector*percent);

      // Return the amount loaded
      return (source-desp);

      // Reset the target value
      dd.target = 0;

      // Close the function
      }

      // Close the above Clip Event
      }

      // When this Movie Clip enters the frame (every 1/12th of a sec) do...
      onClipEvent (enterFrame) {

      // Call the function from above to reset this Movie Clip's width
      this._width = follow(this._width, target, .2);
      }

      ...................<<<<<
      If anyone can see the mistake in the highlight code Please let me know... Or if you know of any better tutorials

      Loads of thanks
      Andy :-D
        • 1. Re: Preloading exturnal SWF's Help
          Level 7
          Hi!

          You can find a very good guide on loading external swf at:
          http://www.gotoandlearn.com/

          /Jensen/

          "andrew dewdney" <webforumsuser@macromedia.com> wrote in message
          news:e7e0d7$i62$1@forums.macromedia.com...
          >
          >
          > I've done a pretty cool site: http://www.thevenusguns.com/danny.html
          > however
          > I've run into the problem of larger SWF files taking longish times to
          > load.
          > I'm trying to find a preloader that exturnally load the large SWF file.
          > Hopefully this Preloader will open quickly so the viewer knows something
          > is
          > happening.
          >
          > I've found at website the offers a hand:
          > http://www.tutorialized.com/tutorial/Preloading-External-Flash-Movies/9384
          >
          > However the coding is crap! I've tried trouble shotting and working my
          > way
          > back through the Action script provided. My flash 8 output panel has
          > found a
          > few errors. Some which I've been able to fix myself.
          >
          > >>>>...............
          > Progress Bar ActionScript
          >
          > You now have to add some code to the Loading bar Movie Clip. What this
          > does is
          > control the width of the bar. So that as more of the object loads the
          > wider bar
          > becomes. The bars width will match the percentage. If 50% has loaded then
          > the
          > bar will be 50 pixels wide etc.
          >
          > Select the Loading bar Movie Clip and add the following code (if you wish
          > leave out the gray comments):

          >
          > // When the Flash Movie loads do the following...
          > onClipEvent (load) {
          >
          > // Call the following function
          > function follow(source, target, percent) {
          >
          > /* Set the variable vector equal to the percentage of the content
          > being loaded and minus current width of this Movie Clip. */
          > vector = (source-target);
          >
          > // Set the desp variable equal to the vector variable times by
          > the
          > percent which is the percentage loaded
          > desp = (vector*percent);
          >
          > // Return the amount loaded
          > return (source-desp);
          >
          > // Reset the target value
          > dd.target = 0;
          >
          > // Close the function
          > }
          >
          > // Close the above Clip Event
          > }
          >
          > // When this Movie Clip enters the frame (every 1/12th of a sec) do...
          > onClipEvent (enterFrame) {
          >
          > // Call the function from above to reset this Movie Clip's width
          > this._width = follow(this._width, target, .2);
          > }
          >
          > If anyone can see the mistake in the highlight code Please let me know...
          > Or
          > if you know of any better tutorials
          >
          > Loads of thanks
          > Mark :-D
          >


          • 2. Re: Preloading exturnal SWF's Help
            andrew_dewdney Level 1
            Your a Legend mate!