35 Replies Latest reply on Oct 7, 2010 3:20 PM by kglad

    Page Flip Won't Reload

    Nana00L Level 1

      Hello,

       

      In my flash file, I embedded a .swf (different page flip from my previous posts) that loads when "Clothes" button is clicked in the flash file.  When I navigate away from this page, it unloads. However, when i click  on "Clothes" again with the .swf, the page flip won't load.

      Reference:
      http://www.lucysonlinestore.co.cc/test/testhome.html

       

      To load the pageflip (under "Clothes"), I'm using:

      var myLoader:Loader = new Loader();

      addChild(myLoader);
      var url:URLRequest = new URLRequest("magazine_flip.swf");
      myLoader.x = -300;
      myLoader.y = -165;


      myLoader.load(url);
      myLoader.unload();


      To unload (for all other buttons), I have:

      myLoader.unload();

      Any advice appreciated.

        • 1. Re: Page Flip Won't Reload
          kglad Adobe Community Professional & MVP

          why are you applying the unload() method immediately after the load() method?


          • 2. Re: Page Flip Won't Reload
            Nana00L Level 1

            I thought it would be for reloading. If I click on another button and click back, the page flip will load properly. That theory is out the window. I'll take it out of my script.

             

            Thank you for looking!

            • 3. Re: Page Flip Won't Reload
              kglad Adobe Community Professional & MVP

              you should be using something like the following to load your swf:

               

               

              var myLoader:Loader = new Loader();

              addChild(myLoader);
              var url:URLRequest = new URLRequest("magazine_flip.swf");
              myLoader.x = -300;
              myLoader.y = -165;

              myLoader.load(url);

               

              //////////////////////////////////////////

              /*

              and something like the following to remove it:

              */

               

              removeChild(myLoader);

              myLoader=null;

              • 4. Re: Page Flip Won't Reload
                Nana00L Level 1

                kglad,

                 

                I replaced myLoader.unload(); with myLoader=null; for all other buttons besides the page flip, it worked in a way. When I click on the other buttons, the page flip page disappears, but the music is still playing. This leads me to think the page flip (embedded .swf) is still playing in the background. When I click "Clothes" again with the page flip, another set of music starts playing, so now you have two sets of music playing at the same time.

                 

                I hope this doesn't sound like a newbie question, but I have a feeling it might. What is the different between myLoader.unload(); vs myLoader=null;? If myLoader isn't being unloaded, and myLoader is called again to import the same .swf, is it just loading the same file on top?

                 

                Thank you again for your help!

                • 5. Re: Page Flip Won't Reload
                  kglad Adobe Community Professional & MVP

                  if you're publishing for fp 10, use:

                   

                   

                  removeChild(myLoader);

                  myLoader.unloadAndStop();

                  myLoader=null;

                  • 6. Re: Page Flip Won't Reload
                    Nana00L Level 1

                    I'm using Flash CS3 and Flash Player 9. Guess unloadAndStop won't work with this.

                    • 7. Re: Page Flip Won't Reload
                      kglad Adobe Community Professional & MVP

                      correct.

                       

                      in your loaded swf, is your music started using the sound class or is your sound attached to a timeline?

                      • 8. Re: Page Flip Won't Reload
                        Nana00L Level 1

                        The music is in the main timeline.

                         

                        The following is used to play it.

                         

                        //Establish a variable for the new sound object, true means streaming.
                        var mySound_sound:Sound = new Sound();
                        mySound_sound.loadSound("music1.mp3", true);
                        //volume
                        mySound_sound.setVolume(50);
                        //Loops the track, also sends the equilizer back to start
                        mySound_sound.onSoundComplete=function(){
                        mySound_sound.loadSound("music1.mp3", true);
                        mySound_sound.setVolume(50);
                        equ.gotoAndPlay("start");
                        }
                        //Hides the play button on start
                        controlbar_mc.play_btn._visible=false;
                        controlbar_mc.play_btn.enabled=false;
                        //Stops the sound onPress and the equalizer
                        controlbar_mc.pause_btn.onPress = function(){
                        mySound_sound.stop();
                        controlbar_mc.play_btn._visible=true;
                        controlbar_mc.play_btn.enabled=true;
                        controlbar_mc.pause_btn._visible=false;
                        controlbar_mc.pause_btn.enabled=false;
                        equ.gotoAndPlay("end");
                        }
                        //Starts the sound onPress and the equalizer
                        controlbar_mc.play_btn.onPress = function(){
                        mySound_sound.start();
                        mySound_sound.setVolume(50);
                        controlbar_mc.pause_btn._visible=true;
                        controlbar_mc.pause_btn.enabled=true;
                        controlbar_mc.play_btn._visible=false;
                        controlbar_mc.play_btn.enabled=false;
                        equ.gotoAndPlay("start EQ");
                        }

                         

                        Thank you again!!!!!

                        • 9. Re: Page Flip Won't Reload
                          kglad Adobe Community Professional & MVP

                          use:


                           

                           

                          var myLoader:Loader = new Loader();

                          addChild(myLoader);
                          var url:URLRequest = new URLRequest("magazine_flip.swf");
                          myLoader.x = -300;
                          myLoader.y = -165;

                          myLoader.load(url);

                           

                          //////////////////////////////////////////

                          /*

                          and something like the following to remove it:

                          */

                           

                          var mc:MovieClip=MovieClip(myLoader.content);

                          mc.mySound_sound.stop();

                          removeChild(myLoader);

                          myLoader=null;

                          • 10. Re: Page Flip Won't Reload
                            Nana00L Level 1

                            That didn't work. The page flip won't disappear no matter which button is clicked. I removed the music. It's not something I need. In four of the buttons, I'm using: removeChild(myLoader); myLoader=null; which seems to work other than the error of using myLoader before it's identified.

                             

                            The problem I'm having now is it works when I test locally. After I uploaded onto the server, it doesn't work anymore.

                             

                            Reference:

                            http://www.lucysonlinestore.co.cc/test/testhome.html

                             

                            Maybe a setting needs to be changed on the server side?

                             

                            Thank you again!!!!!!

                            • 11. Re: Page Flip Won't Reload
                              Nana00L Level 1

                              I thought it might be a problem on the server side but after I uploaded all the files on to another server, the page flip still won't reload. I'm puzzled by why page flip reloads when I test it locally but on the server, it doesn't work.

                               

                              Any insight is apprecited.

                              • 12. Re: Page Flip Won't Reload
                                Nana00L Level 1

                                I might have jumped the gun on local testing being successful. When I test run the .fla file (with embedded .swf, page flip), page flip reloads perfectly. However, when I test the html locally, page flip won't reload. Do I need to add any html tags to to remove cache/cookies so page flip can be loaded again?

                                 

                                I'm not sure where the hang up is at this point to fix it.

                                • 13. Re: Page Flip Won't Reload
                                  kglad Adobe Community Professional & MVP

                                  does everything work with opening (in your browser) your html locally?  or does it work when opening the html on a server?

                                  • 14. Re: Page Flip Won't Reload
                                    Nana00L Level 1

                                    The page flip won't reload when I open the html locally and on the server. The page flip reloaded correctly only when I test run the flash file with the embeded .swf (page flip). Now I'm even more confused. I don't know what's in the html file/browser that's causing the page flip not to reload .

                                    • 15. Re: Page Flip Won't Reload
                                      kglad Adobe Community Professional & MVP

                                      what's this mean:

                                       

                                      The page flip reloaded correctly only when I test run the flash file with the embeded .swf (page flip).

                                       

                                      does that mean everything works when you test in the flash test environment (control/test movie)?

                                      • 16. Re: Page Flip Won't Reload
                                        Nana00L Level 1

                                        Sorry for the confusion. Lack of sleep and hair falling over these issues is really starting to show...

                                         

                                        I have three files. testhome.html, test.fla (test.swf), and catalog.fla (catalog.swf). The catalog.swf (page flip) is embedded in test.fla, meaning test.fla is using a loader to load the catalog.swf (page flip) under "Clothes" menu. When I test run test.fla, it loads and unload catalog.swf correctly (I think). The page flip is able to reload properly after I navigate away, say visits the "Contact" page and comes back to the page flip page. However, this isn't happening in the testhome.html which calls test.swf. From testhome.html, when I revisit the page flip, only the background, and menu buttons (cover, 1/2, 3/4, 5/6...) are present, but not the page flip itself.

                                         

                                        Reference (page flip under "Clothes"):

                                        http://www.lucysonlinestore.co.cc/test/testhome.html

                                         

                                        The same thing is happening when I run the testhome.html locally. When I test run test.fla, page flip works perfectly.

                                         

                                        I'm don't know what is happening to cause this.

                                        • 17. Re: Page Flip Won't Reload
                                          kglad Adobe Community Professional & MVP

                                          publish an html file from flash and test using it.  don't edit it.  any problems?

                                          • 18. Re: Page Flip Won't Reload
                                            Nana00L Level 1

                                            Very good idea! I published test.fla in html and the page flip won't reload just like when I tested testhome.html. Hmmm....flash and html doesn't like each other?

                                            • 19. Re: Page Flip Won't Reload
                                              kglad Adobe Community Professional & MVP

                                              you still have these errors (which are probably not related to your current issue):

                                               

                                              TypeError: Error #2007: Parameter child must be non-null.
                                                  at flash.display::DisplayObjectContainer/removeChild()
                                                  at test_fla::contents_8/frame1()[test_fla.contents_8::frame1:1]
                                              TypeError: Error #2007: Parameter child must be non-null.
                                                  at flash.display::DisplayObjectContainer/removeChild()
                                                  at test_fla::contents_8/frame2()[test_fla.contents_8::frame2:1]

                                               

                                              and there's something going on with your page-turn loader that probably is related to your current issue.  it looks like your preloader isn't detecting the page-turn is loaded because it loads too quickly when it's in the cache.  you need to check the coding on that preloader and fix it.

                                              • 20. Re: Page Flip Won't Reload
                                                Nana00L Level 1

                                                I think the errors are caused by using variables before it's defined and removing the child before it's added. For example, in frame 1, I have removeChild(myLoader); myLoader=null; and in frame 3, I'm defining myLoader and addChild(myLoader).

                                                 

                                                Right now the preloader is in a mc with the following code:

                                                frame1:

                                                var amountLoaded:Number = _root.getBytesLoaded()/_root.getBytesTotal();
                                                //preloader._width = amountLoaded * 250;
                                                loadText.text = Math.round(amountLoaded * 100) + "%";

                                                 

                                                frame2:

                                                if(_root.getBytesLoaded() == _root.getBytesTotal()) {
                                                    _root.gotoAndPlay(2);
                                                }
                                                else {
                                                    gotoAndPlay(1);
                                                }

                                                 

                                                Will it help if I put the preloader in a different scene before the main scene?

                                                • 21. Re: Page Flip Won't Reload
                                                  kglad Adobe Community Professional & MVP

                                                  in your as2 swf frame 1 line 1, add:

                                                   

                                                  this._lockroot=true;

                                                  • 22. Re: Page Flip Won't Reload
                                                    Nana00L Level 1

                                                    kglad,

                                                     

                                                    That did the trick!! I don't completely understand, but it worked! Thank you so much for guiding me through these problems! I can't express how grateful I am!! Thank you for being so patient, thorough, and very responsive!!

                                                     

                                                    Just one more question, how are you able to see the errors the fla file is generating? I'm wondering if there is a debugging tool that gives more explanation.

                                                     

                                                    THANK YOU AGAIN!!!!

                                                    • 23. Re: Page Flip Won't Reload
                                                      Nana00L Level 1

                                                      Just one little thing that bugs me, it's not important, if it's going to take up too much time then don't worry about it. For the page flip, when I turn the pages, there is suppose to be sound with each turn. When I test the .fla movie, the sound is there. But when I publish the .fla in HTML, the sound is not. It's strange.

                                                      • 24. Re: Page Flip Won't Reload
                                                        kglad Adobe Community Professional & MVP

                                                        in your as2 swf where you have:

                                                         

                                                        .... = new Sound();

                                                         

                                                         

                                                        use:

                                                         

                                                        ... = new Sound(this);

                                                        • 25. Re: Page Flip Won't Reload
                                                          Nana00L Level 1

                                                          That didn't work . Just curious, how are you able to see the code?

                                                          • 26. Re: Page Flip Won't Reload
                                                            kglad Adobe Community Professional & MVP

                                                            i can't see your code.

                                                             

                                                            i just thought you were creating a sound instance on your loaded swf's main timeline and you used the "new" constructor.  is that correct?

                                                             

                                                            if it is, almost always the solution i suggested will work.  make sure you applied it correctly to all sound instances in the loaded swf.

                                                            • 27. Re: Page Flip Won't Reload
                                                              Nana00L Level 1

                                                              I guess you just know the code very well.

                                                               

                                                              I went through the actionscript on the swf and found two places with the sound code which I changed to what you suggested:

                                                               

                                                                  var sou:Sound = new Sound(this);
                                                                  sou.loadSound("pageturn.mp3", true);

                                                               

                                                              When I test the movie, the page turn sound works. But when I published the swf in HTML, the sound doesn't work.

                                                              • 28. Re: Page Flip Won't Reload
                                                                kglad Adobe Community Professional & MVP

                                                                lol.  nana, you have more "strange" problems with flash.

                                                                 

                                                                did you test using the html flash publishes?

                                                                • 29. Re: Page Flip Won't Reload
                                                                  Nana00L Level 1

                                                                  Haha. I do. I don't know what made these "strange" problems appear, and worse is I don't know how to fix it .

                                                                   

                                                                  Adding to the "strange" problems list...yes, I tested the html that flash published and the sound doesn't work

                                                                  • 30. Re: Page Flip Won't Reload
                                                                    kglad Adobe Community Professional & MVP

                                                                    is the as3 swf (with the loader that loads your page-turn swf) in the same directory as your as2 swf (that loads your sound)?

                                                                     

                                                                    if not, the path to load your sound must be changed.

                                                                    • 31. Re: Page Flip Won't Reload
                                                                      Nana00L Level 1

                                                                      Yes. The as3 swf and the as2 swf (page turn) are in the same directory as the mp3. The weird thing is, when I "Test Movie" for the as2 swf (page turn), the sounds works, but when I publish this file using the Edit->Public->HTML, the sound doesn't work. So this leads me to think there is something wrong with the as2 swf?

                                                                      • 32. Re: Page Flip Won't Reload
                                                                        kglad Adobe Community Professional & MVP

                                                                        there's no "Edit->Public->HTML".

                                                                         

                                                                        there's a file/publish settings/html.

                                                                        • 33. Re: Page Flip Won't Reload
                                                                          Nana00L Level 1

                                                                          Sorry. That's what I meant

                                                                          • 34. Re: Page Flip Won't Reload
                                                                            kglad Adobe Community Professional & MVP

                                                                            what seems like an insignificant detail to you may be an insignificant detail but it indicates an imprecise use of language.  and in forums, that (language) is the only way to share information.  it's common for people seeking help to mis-state something that throws would-be helpers on the wrong track.  usually we end up eventually finding the problem despite the poor use of language.  but that hasn't happened for your sound problem.

                                                                             

                                                                            at this point, i'll bet money something you've represented in this thread isn't factual.  i don't know what that is or i could still help you.

                                                                            • 35. Re: Page Flip Won't Reload
                                                                              Nana00L Level 1

                                                                              kglad,

                                                                               

                                                                              I'm not sure I understand what you're referring to. Is what you call "my poor use of language" stating "Edit->Publish->HTML" instead of "File->Publish->HTML"? How is this one incident a determining factor on what I presented on this thread isn't factual? I'm a bit confused.

                                                                               

                                                                              The problem is, I have a flash file that when I "Test Movie", the sound works. But when I publish the HTML in flash, the sound doesn't work. I wish I could upload the file somehow to show the problem. I made an error saying "Edit->Publish->HTML" instead of "File->Publish->HTML" and this implied I lied on this thread? I'm not sure I understand you, but I'm trying to.