9 Replies Latest reply on Nov 6, 2006 12:02 PM by calhoontuna

    trying to add a preloader to a slide presentation

    bb73
      Hello,

      I've created a Flash presentation (using version 8 pro) using the presentation template for streaming online. Here's a quick overview of the project:
      - there are 68 total slides
      - slide 1 is the primary parent slide and contains the preloader info
      - slide 2 is the secondary parent slide (a child to the preloader slide) that contains the FLV playback component
      - slides 3-68 are child slides to the slide that contains the FLV playback component
      - the FLV runs though the FLV playback component with a 5 second buffer and is set to export in the first frame
      - the FLV was exported out of Final Cut Pro with cue points embeded, which tell the slides when to advance
      - the presentation is exported as a .swf that is then played though a container file that will eventually give the user options to play other presentations. (right now there's just one that automatically loads)

      Everything works fine, however I'm trying to figure out how to create a preloader for the .swf file of the presentation itself that is being loaded. No matter how I configure it, the preloader just won't work. Since I'm using the presentation template does that have any effect as to how the preloader functions? The preloader itself is set up as follows and functions just fine when using it to load the initial container file:

      myLoaded = Math.round(getBytesLoaded());
      myTotal = Math.round(getBytesTotal());
      myPercent = myLoaded/myTotal;
      myBar._width = myPercent*150;
      myText = Math.round(myPercent*100)+"%";
      if (myLoaded == myTotal) {
      gotoAndPlay(3);
      } else {
      gotoAndPlay(1);
      }

      "myBar" is the loading bar movie clip and "myText" is the variable that displays the percentage loaded.
      This preloader is on the parent slide. The FLV playback component is on the 3rd frame of the next slide. (the preloader elements don't extend past the 2nd frame)
      It seems like the preloader should play as all the info from the slides are loaded, then advance to frame 3 and play the FLV, but that's not happening. The preloader doesn't show at all while the info is loading and after it's loaded the first frame of the 3rd slide is displayed (slide 1 of the actual presentation) without the FLV playback component and it just sits there. At that point the preloader instantly appears, is fully loaded and says NaN% instead of 100%. If I pull the preloader out and re-publish the .swf file everything runs correctly, but of course there's no preloader.

      I'm at a loss at this point. I even tried putting the FLV playback component on the 3rd frame of the preloader so that there was only 1 parent slide, but that didn't work either. Same results as mentioned above, but the preloader didn't show up at all. All I can think of is that since the presentation template is set up with a parent slide and child slides beneath, the preloader isn't reading that info correctly, like if everything was on one timeline on the same level.

      Here's a link to the presentation as it exists with the preloader in the container file only. No preloader in the .swf file that contains the FLV and slides. (this is a testing area, please ignore any abnormalities in the html and surrounding elements)

      http://www.aafp.org/multimedia/afpfpmtest/index.htm

      any ideas?
      thanks.
        • 1. Re: trying to add a preloader to a slide presentation
          phil ashby Level 1
          Had a similiar problem with a form app that I built. Got around it like this.

          Create a seperate 1 frame movie clip (standard flash doc) with the same dimensions as your main slideshow. Drop the preloader component onto it and resize to stage size. Give it an instance name eg myLoadBar,

          Then put this code on frame1 - worked for me!

          listenerObject = new Object();
          listenerObject.complete = function(eventObject) {
          myLoadBar._visible = false;
          };
          myLoader.addEventListener("complete", listenerObject);
          myLoader.content._lockroot=true;
          • 2. Re: trying to add a preloader to a slide presentation
            bb73 Level 1
            Thanks for the response! I'm not quite following though.
            When you say "Create a seperate 1 frame movie clip (standard flash doc) ," do you mean create the preloader in a separate FLA, publish it and then bring that .swf into the slide presentation file to use as the preloader? And when you say "preloader component," do you mean there's a preloader component in the component panel?
            thanks again.
            • 3. Re: trying to add a preloader to a slide presentation
              TimSymons Level 1
              I believe your problem is that you have the FLV compentent exporting on the 1st frame. All exported components will load first, then the elements in the first frame will be processed. You should set up your componenet to export on the 3rd frame. This will allow your preloading movie to execute first.

              Remember, that even though you design in multiple timelines, when Flash publishes the file, it effectively creates a single timeline with all of the elements place appropriately.

              Tim
              • 4. Re: trying to add a preloader to a slide presentation
                bb73 Level 1
                I tried changing it to the 3rd frame for exporting, but no luck. The FLV doesn't even show up when publlished unless it's sitting on the first frame of the slide that it's on. What about under Publish settings / Actionscript 2.0 settings - should the "export frame for classes" be 1 or 3? (it's 1 by default)
                So if everything basically ends up on the same timeline when published, does that mean the first 3 frames of each slide need to be empty in order for the preloader to function correctly?

                thanks
                • 5. Re: trying to add a preloader to a slide presentation
                  phil ashby Level 1
                  Sorry BB73, misled you with my earlier post.... try this.

                  Create new Flash doc, same dimensions as your original movie
                  In the components panel you should find a LOADER component.
                  Drag onto stage and resize to the stage dimensions, call it myLoader.
                  Now, also in the componets panel, locate the PROGRESSBAR and drop into the centre of the stage, calling it myLoadBar.
                  In the parameters tab for the ProgressBar, enter the SWF file of your main movie as the source.
                  Enter the code in my previous post and publish with HTML
                  Now open the new HTML and hey presto.

                  Phil
                  • 6. Re: trying to add a preloader to a slide presentation
                    bb73 Level 1
                    Ok, that makes sense.
                    I set it up as you said, however nothing happens with I open the newly created preloader HTML file - the loader bar comes up, but doesn't load anything. It just sits there at 0%.
                    I know I have to be close. There's just something I'm not seeing. I checked the source for myLoadBar and it says "COPDyawn1.swf", which is the .swf I want to load. I copied and pasted in the action script you gave me, so there shouldn't be any issues with that. Here it is to check out just in case:

                    listenerObject = new Object();
                    listenerObject.complete = function(eventObject) {
                    myLoadBar._visible = false;
                    };
                    myLoader.addEventListener("complete", listenerObject);
                    myLoader.content._lockroot=true;

                    The instance name of the Loader component is "myLoader" (which has been re-sized to 550x550, the dimensions of the .swf being loaded) and the instance name of the Progress Bar is "myLoadBar".

                    The action script, myLoadBar and myLoader all exist on separate layers in the first and only frame of the file.

                    Not sure what the deal is! Any thoughts?
                    thanks again for the help!
                    • 7. Re: trying to add a preloader to a slide presentation
                      phil ashby Level 1
                      How come I can mess up the instructions for something so simple! AGAIN!

                      DOH!

                      Try this...select your Preloader (myLoadBar) and change the source to be myLoader.

                      Now change the contentPath of myLoader to be COPDyawn1.swf

                      So, basically, the preloader is looking at the loader and the loader is looking at your swf.

                      Sorry to confuse you...I am slapping myself now....
                      • 8. Re: trying to add a preloader to a slide presentation
                        bb73 Level 1
                        Worked like a charm!
                        Many thanks!!!
                        • 9. Re: trying to add a preloader to a slide presentation
                          calhoontuna
                          I've tried using your code and suggestions to preload a slide presentation. It worked but with two problems. 1) the loaded file is much smaller than it should be. 2) no audio.

                          On the original presentation there was an audio element related to each slide. However, when the preloader loads that file it goes silent. Am I missing something here?