20 Replies Latest reply on Oct 21, 2010 3:41 PM by Andymc7

    Preloader kills loadMovie

    Andymc7 Level 1

      I have two scenes. One with my preloader and the other with all the rest of my content. It's a simple slideshow that utilizes the loadMovie function to load external jpeg's into it. However, when I add a preloader in a separate scene, my images disappear in my slideshow. My loadMovie is located on the same frame as the first frame of each movie, so it should still work. I'm at a loss.

       

      Any help would be greatly appreciated. I can paste my AS for the preloader or the main timeline if that helps

       

      Thanks in advance

        • 1. Re: Preloader kills loadMovie
          kglad Adobe Community Professional & MVP

          show the code you have on the first frame that fails to respond as expected and explain what happens when the playhead reaches that frame.

          • 2. Re: Preloader kills loadMovie
            Andymc7 Level 1

            Thanks for the quick response...

             

            I've learned for some reason that my loadMovie must be placed aligning with the same frame where my loader mc is. Here's all I have:

             

            loadMovie("slide1.jpg", slideone);

             

            Very simple, but works like a charm, until I try and add a preloader in a separate scene. That's when my images in the slideshow don't show up.

             

            In my preloader scene, I have:

             

            myLoaded = Math.round(getBytesLoaded());
            myTotal = Math.round(getBytesTotal());
            myPercent = myLoaded/myTotal;
            myBar._width = myPercent*150;
            myText = Math.round(myPercent*100)+"%"+" Loaded";
            if (myLoaded == myTotal) {
                gotoAndPlay("Main", "start");
                loadMovie("slide1.jpg",slideone);
            } else {
                gotoAndPlay(1);
            }

             

            My preloader has two frames, and a few layers containing the loader bar and text.

            As you can see, I've attempted to go ahead and run the loadMovie function in my preloader scene.

            • 3. Re: Preloader kills loadMovie
              Andymc7 Level 1

              By the way, you can go to sciotoshoemart.com to see my simple slideshow that works fine, but

              has no preloader.

              • 4. Re: Preloader kills loadMovie
                kglad Adobe Community Professional & MVP

                so, you're trying to preload your main site with that, NOT slide1.jpg, correct?

                 

                if so, (actually, no matter you're answer to the above, you should) never use scenes in navigation and not use the goto functions.  use frame labels or numbers and the goto methods:

                 

                // this should be, at least, 2 frames beyond from 1:

                 

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

                 slideone.loadMovie("slide1.jpg");


                    _root.gotoAndPlay("Main_start");  // label this frame
                  
                } else {
                    _root.gotoAndPlay(1);
                }

                 


                • 5. Re: Preloader kills loadMovie
                  Andymc7 Level 1

                  Hey kglad, thanks so much for your help, but unfortunately my slide images still disappear after the preloader runs. I can upload my .fla file if you'd be willing to take a look. Of course, I would probably have to include the 5 jpegs as well.

                   

                  Thanks anyway, I appreciate the help thus far.

                  • 6. Re: Preloader kills loadMovie
                    kglad Adobe Community Professional & MVP

                    slide1 must exist on "Main_start" and all the frames that play after that frame until a stop() is reached.  if you think it does exist on that frame, put the following code on "Main_start" and copy and paste your output panel contents here:

                     

                     

                    stop();

                    trace(slide1+" "+slide1._alpha+" "+slide1._visible);

                    1 person found this helpful
                    • 7. Re: Preloader kills loadMovie
                      Andymc7 Level 1

                      Ok, I pasted the above code on the first frame of the slideshow as you said, and I get:

                       

                      "undefinded undefinded undefinded"

                       

                      in the output window

                      • 8. Re: Preloader kills loadMovie
                        kglad Adobe Community Professional & MVP

                        that establishes that i was correct.  slide1 does NOT exist on "Main_start".  fix that.

                        • 9. Re: Preloader kills loadMovie
                          Andymc7 Level 1

                          Yes, the slideone mc is there. I pasted in the frame where the slideshow starts AND in both frames where the preloader exists. Still no images showing.

                          • 10. Re: Preloader kills loadMovie
                            Andymc7 Level 1

                            I just had a thought, I'm not sure it would help. But what if I place all my slide mc's into blank mc's and just place my loadMovie code in the first frame of them? I really think it must have something to do with that finnicky loadMovie method. Would that make any difference?

                            • 11. Re: Preloader kills loadMovie
                              kglad Adobe Community Professional & MVP

                              that's not going to work.

                               

                              go the the frame that contains that loadMovie() code.  remove slide1 from the stage.  add the following before your loadMovie() code and retest:

                               

                              this.createEmptyMovieClip("slide1",this.getNextHighestDepth());

                              1 person found this helpful
                              • 12. Re: Preloader kills loadMovie
                                Andymc7 Level 1

                                Well, that makes my jpeg show up just fine, but again, all the slide images disappear after I test my preloader on the 56k simulation. Should I just publish the thing and put it online to see what happens?

                                • 13. Re: Preloader kills loadMovie
                                  kglad Adobe Community Professional & MVP

                                  that won't help.

                                   

                                  anything on-stage in one scene will disappear when you change scenes.  so, anything that you want to exist when changing scenes needs to be created with actionscript.

                                  • 14. Re: Preloader kills loadMovie
                                    Andymc7 Level 1

                                    Hmm.. I think you must think I still have two separate scenes I'm trying to navigate between. I don't. I took your advice and just have one scene now, which has two frames for the preloader, then the slide animations start on frame 3, which I've named "slideshow_start".

                                    • 15. Re: Preloader kills loadMovie
                                      kglad Adobe Community Professional & MVP

                                      great.  that will make everything much easier.

                                       

                                      now, what's in frame1, frame2 and frame 3?

                                      • 16. Re: Preloader kills loadMovie
                                        Andymc7 Level 1

                                        Ok, frame 1, named "preloader_start", has the preloader graphics(just a bar and text)

                                         

                                        frame 2 also has the preloader graphics and now has:

                                         

                                        myLoaded = Math.round(getBytesLoaded());
                                        myTotal = Math.round(getBytesTotal());
                                        myPercent = myLoaded/myTotal;
                                        myBar._width = myPercent*150;
                                        myText = Math.round(myPercent*100)+"%"+" Loaded";
                                        if (myLoaded == myTotal) {
                                            slideone.loadMovie("slide1.jpg");
                                            _root.gotoAndPlay("slideshow_start");
                                        } else {
                                            _root.gotoAndPlay(1);
                                        }

                                         

                                        , and frame 3 is the start of the slideshow, with a label of "slideshow_start"

                                         

                                         

                                        Hey! I uploaded the swf and it SEEMS to work now. Would you mind checking it out? LINK The preloader just seems to briefly flash, but I do have fast internet, so maybe that's why.

                                        • 17. Re: Preloader kills loadMovie
                                          kglad Adobe Community Professional & MVP

                                          looks good to me.

                                           

                                          please mark this thread as answered.

                                          • 18. Re: Preloader kills loadMovie
                                            Andymc7 Level 1

                                            Cool! Thanks so much

                                            • 19. Re: Preloader kills loadMovie
                                              kglad Adobe Community Professional & MVP

                                              you're welcome.

                                               

                                              and, it doesn't really look like you need a preloader.  that swf is only about 7kb.  even on dial-up that would take less than 2 seconds to load.

                                              • 20. Re: Preloader kills loadMovie
                                                Andymc7 Level 1

                                                Oh, really? Haha.. I guess you're right. Oh well, now I know how to get it to work.