1 2 Previous Next 56 Replies Latest reply on May 21, 2007 9:17 AM by kglad

    Need Preloader

    metrov Level 1
      Hi,

      Can someone please recommend a .fla or Tutorial for creating preloaders for movies that get loaded into targets?

      I've created many preloaders that work great. The preloader goes into the first scene, and when x number of frames are loaded in the Main scene, then the action takes us to the first frame of the Main scene.

      total_bytes = _root.getBytesTotal();
      loaded_bytes = _root.getBytesLoaded();
      remaining_bytes = total_bytes-loaded_bytes;
      percent_done = int((loaded_bytes/total_bytes)*100);
      bar.gotoAndStop(percent_done);
      ifFrameLoaded ("Main", "frame100") {
      gotoAndPlay("Main", "frameone");
      }


      But this type of preloader does not work for an external.swf that's loaded into a target on level0. When the button action takes place calling up the .swf that's loaded into the target, the preloader never shows up. Nothing shows up until the 'entire' .swf is loaded, and then, of course, it goes right to the first frame [frameone].

      So, is there another way to do this? Or will this type of preloader not work with movies that are loaded into targets?

      Is there another type of preloader all together that will work for this purpose.

      Thanks so much for your help.

      cheers
        • 1. Re: Need Preloader
          kglad Adobe Community Professional & MVP
          use your target movieclip instead of _root, don't use scenes for navigation (use frame labels) and don't use the goto functions use the goto methods (whateverMC.goto).
          • 2. Re: Need Preloader
            metrov Level 1
            I'm still having trouble getting anything to work.

            I've built a small set of sample.flas that mimic my project. I can email as .zip. It's only 30k. If someone could take a look at my code [button & preloader], and tell me what is wrong, I'd be EXTREMELY grateful.

            Essentially, my nav button needs to load a .swf into a target. In real life, this .swf is quite large, and so needs a preloader.

            Thank you, a million thank yous.
            • 3. Re: Need Preloader
              kglad Adobe Community Professional & MVP
              post a link to your zip file.
              • 4. Re: Need Preloader
                metrov Level 1
                Here is the link to my .zip file.

                SAMPLE .FLA

                Thank you so much for looking it over.
                • 5. Re: Need Preloader
                  kglad Adobe Community Professional & MVP
                  is startTest the _level0 or main swf? will it be loading swf's whose load progress you want displayed using the assets in 1.swf?
                  • 6. Re: Need Preloader
                    metrov Level 1
                    //is startTest the _level0 or main swf? will it be loading swf's whose load progress you want displayed using the assets in 1.swf?

                    Yes, 'startTEST' is _level0.

                    There is a target in _level0.

                    I want the button to load 1.swf that target.

                    I want to see the progress of 1.swf as it's being loaded.

                    Thank you
                    • 7. Re: Need Preloader
                      kglad Adobe Community Professional & MVP
                      1.swf IS your preloader. it contains the assets that you'll use to display the load progress of your large files.

                      it doesn't make any sense to display the load progress of your preloader unless you're going to use a smaller preloader to do that.
                      • 8. Re: Need Preloader
                        metrov Level 1
                        Look at the 'scenes' in 1.swf.

                        Preloader is in first scene. Movie is in next scene. Look at the code in the preloader, it will tell you how it works.
                        • 9. Re: Need Preloader
                          kglad Adobe Community Professional & MVP
                          ok.

                          replace your code in 1.swf with the code below and label the first frame of main, main scene:

                          • 10. Re: Need Preloader
                            metrov Level 1
                            Did you try what you asked me to do? Because it doesn't work.

                            It seems the button does not even load the movie at all. That seems to be part of the problem, perhaps the entire problem. The code in the button does not load the movie, so how could the preloader even have a chance to work?

                            Could you please try employing your code, then launch 'startTEST.swf', then see that the button doesn't seem to be working. I wasn't sure if it was the code in the preloader, or the code in the button. Now maybe we know the code in that button isn't working. Maybe you could help me with that code -- the code in the button.

                            Thank you so much.
                            • 11. Re: Need Preloader
                              kglad Adobe Community Professional & MVP
                              i didn't test it. there's nothing to test. 1.swf is a preloader. when it loads the preloader isn't needed. you'll see no preloader until you add more content to 1.swf.

                              but looking at the button's code you have an incorrect path to target:

                              on (release) {
                              loadMovie("1.swf", _level0.target);
                              }
                              • 12. Re: Need Preloader
                                metrov Level 1
                                Wow, it seems to be working now. THANK YOU so much.
                                • 13. Re: Need Preloader
                                  kglad Adobe Community Professional & MVP
                                  you're welcome.
                                  • 14. Re: Need Preloader
                                    metrov Level 1
                                    Actually, I have one last question. The movie I'm 'preloading' is quite large. But it doesn't have to be TOTALLY loaded before the visitor can start looking at it. I'd like the preloader to go to the 'content' part of the movie when it's about HALF loaded. However, I"ve tried modifying the code, and it only seems to work in its original form, i.e.:

                                    total_bytes = this.getBytesTotal();
                                    loaded_bytes = this.getBytesLoaded();
                                    remaining_bytes = total_bytes-loaded_bytes;
                                    percent_done = int((loaded_bytes/total_bytes)*100);
                                    bar.gotoAndStop(percent_done);
                                    if (percent_done == 100) {
                                    this.gotoAndPlay("main scene");
                                    }

                                    I tried changing *100 to *200 and '...done == 100' to '...done == 50', and that works if I 'simulate download' in Flash / Test mode, but does not work in real life. The preloader just freezes.

                                    Is there a way to modify the preloader code so that it will load the movie once it is HALF loaded?

                                    Thanks again.
                                    • 15. Re: Need Preloader
                                      kglad Adobe Community Professional & MVP
                                      use:

                                      if (percent_done >= 100) {
                                      this.gotoAndPlay("main scene");
                                      }
                                      • 16. Re: Need Preloader
                                        metrov Level 1
                                        Thank you again, very very much!
                                        • 17. Re: Need Preloader
                                          kglad Adobe Community Professional & MVP
                                          you're welcome. (but, that was supposed to be 50, not 100.) obviously you figured that out.
                                          • 18. Need Preloader
                                            metrov Level 1
                                            Yes, I changed the 100 to 50, and it works great.

                                            Actually, I hate to be a pest, but another question has come up. The first time the button is clicked, the preloader appears as the movie is loading into its target.

                                            However, if the button is clicked a 2nd time [or however many more times], the movie loads into the target all over again.

                                            Is there some code I can use that would check and see if the movie has already been loaded into the target, and, if so, bypass the load command, and go directly to the first frame of the movie?

                                            If you know of something, thank you.
                                            • 19. Re: Need Preloader
                                              kglad Adobe Community Professional & MVP
                                              no, but you could create such code.

                                              in your preloader you would note when loading is complete by setting a variable's value (say, loadComplete=true) and use that variable (in an if-statement) to determine if you want to execute the loadMovie() statement in that button handler.
                                              • 20. Need Preloader
                                                metrov Level 1
                                                I'm sorry, but I cannot create such code. I am a designer, and I only know very simple AS. I would not know where to begin. Would you have time to create this code for me? I don't know where you are, but perhaps I could send you a small payment via Paypal?
                                                • 21. Re: Need Preloader
                                                  kglad Adobe Community Professional & MVP
                                                  the coding's too easy to charge you. but there is one complication.

                                                  because you're not loading to completion before advancing your timeline and that stops your preloader from determining when loading is complete you'll need to change your code somewhat.

                                                  here's a solution:

                                                  • 22. Need Preloader
                                                    metrov Level 1
                                                    I must be doing something wrong because it's not working.

                                                    The preloader movie [the gauge needle] just plays to the end, then goes back to the beginning, plays to the end again, over and over and over -- it never loads the movie.

                                                    Can you please tell me what I'm doing wrong here?

                                                    Thank you

                                                    I am doing the following:
                                                    • 23. Re: Need Preloader
                                                      kglad Adobe Community Professional & MVP
                                                      no, there's a logic problem with my code.

                                                      use:

                                                      • 24. Need Preloader
                                                        metrov Level 1
                                                        I tried your revised code. It does exactly the same thing. The preloader just keeps repeating, and the movie does not load.

                                                        btw, this has always been in the second frame of my preloader: gotoAndPlay(1);

                                                        I tried taking it out, and the preloader doesn't work at all.
                                                        • 25. Re: Need Preloader
                                                          kglad Adobe Community Professional & MVP
                                                          there's another error:

                                                          • 26. Re: Need Preloader
                                                            metrov Level 1
                                                            I'm sorry, it's still doing the same thing -- preloader just keeps repeating -- movie does not load.
                                                            • 27. Re: Need Preloader
                                                              metrov Level 1
                                                              If it's easier and simpler, maybe we can just load the whole movie [100%]?
                                                              • 28. Re: Need Preloader
                                                                metrov Level 1
                                                                kglad, hello? Did you give up on this? Thank you
                                                                • 29. Re: Need Preloader
                                                                  kglad Adobe Community Professional & MVP
                                                                  no, i didn't give up. we should solve this.

                                                                  post a link to your latest files.
                                                                  • 30. Re: Need Preloader
                                                                    metrov Level 1
                                                                    Thank you very much

                                                                    zip
                                                                    • 31. Re: Need Preloader
                                                                      kglad Adobe Community Professional & MVP
                                                                      try:

                                                                      www.gladstien.com/Files/1.fla
                                                                      • 32. Re: Need Preloader
                                                                        metrov Level 1
                                                                        Hi,

                                                                        OK, I tried the latest code. The movies load now, but they still re-load each time.

                                                                        You can see the actual site I'm building for client here:

                                                                        CLIENT WEBSITE

                                                                        Disregard the preloader for the home page. That is set up completely differently. Please try THE WORK / 'Print Ads' and 'Collateral'. Those two are using the preloader code. And as you will see, they re-load each time you come back.

                                                                        I am very grateful if you are still willing to resolve this.

                                                                        Thanks so much.
                                                                        • 33. Re: Need Preloader
                                                                          metrov Level 1
                                                                          Hi,

                                                                          OK, I tried the latest code. The movies load now, but they still re-load each time.

                                                                          You can see the actual site I'm building for client here:

                                                                          CLIENT WEBSITE

                                                                          Disregard the preloader for the home page. That is set up completely differently. Please try THE WORK / 'Print Ads' and 'Collateral'. Those two are using the latest preloader code. And as you will see, they re-load each time you come back.

                                                                          I am very grateful if you are still willing to resolve this.

                                                                          Thanks so much.
                                                                          • 34. Re: Need Preloader
                                                                            kglad Adobe Community Professional & MVP
                                                                            is the code below attached to your button:

                                                                            • 35. Re: Need Preloader
                                                                              metrov Level 1
                                                                              Yes, that is exactly the code in my button.

                                                                              I also just discovered another problem. If I click 'Collateral' and it starts to preload, then I click 'Print Ads' before Collateral is completely loaded -- both movies get loaded on top of each other. I don't want to drive you crazy with this, but again I can pay a little if you're willing to stick with it.

                                                                              Thank you
                                                                              • 36. Need Preloader
                                                                                metrov Level 1
                                                                                It may be possible that no one will ever [or very rarely] click on the one movie while the other is still loading. If they get impatient, maybe...
                                                                                • 37. Re: Need Preloader
                                                                                  kglad Adobe Community Professional & MVP
                                                                                  here are the files working together:

                                                                                  http://www.gladstien.com/Files/preloader.zip
                                                                                  • 38. Need Preloader
                                                                                    metrov Level 1
                                                                                    I implemented the new code into the site nav buttons.

                                                                                    It seemed to work fine on first click. But upon clicking either button a 2nd time, the 'loading gauge needles' simply go to the end and stop, and that's it. That's all that happens.

                                                                                    So I created another 'test' version of the project, this one with two buttons, and more images as content. However, when I implemented the code into this test version, it behaves differently. You can only load one movie, whichever movie loads first. After that, the remaining movie won't load. I don't know what's different about this one, but my head is beginning to spin trying to figure out what's going on.

                                                                                    Having said all that, I am confident that if you can get this version working, it will definitely resolve the issue for the actual website.

                                                                                    NEW VERSION OF SAMPLE TEST .FLAS

                                                                                    Thank you again, Doctor. I will be happy to repay you anyway I can. The problem is, now I've told client I would have this new version of the preloader working for him, so he is expecting it.
                                                                                    • 39. Re: Need Preloader
                                                                                      kglad Adobe Community Professional & MVP
                                                                                      that gotoAndPlay() doesn't look good. do you really want to play those frames in main one after another?
                                                                                      1 2 Previous Next