17 Replies Latest reply on Dec 28, 2008 1:00 PM by kglad

    the dreadful Scene Change and Preloader


      I've put alot of blood, sweat, and tears into building this site and the simple parts are causing the most trouble.

      Scene changes work (used to), I found early on that if I moved the longest scene to the end, it did not conflict with the other menu buttons. It seems like at random, or when the movie is slow to load, the buttons go to the wrong scene and start playing at random frames and the buttons will not react.

      Preloader works (on one scene), when i move the same eact code to another scene and just change the instances and scene information, I only get a blank screen when the movie is loading, and then to top it off, it will redirect to another scene in an odd frame. I have tried a number of diferent codes to make the preloader work, all of the standard "stay on this frame until the rest load and then play" codes.

      I think these two problems are related and I was searching for informaiton on ROOT and GLOBAL because I don't really understand them. You can see some of my flash site at www.danieljkessler.com I think the problem isn't the way I am coding but something I am missing that is conflicting with scene changes. Again, the navigation seems to work fine in the actual movie file, but when its online or Previewed, it has these nasty problems.

      I am willing to pay a small fee to have them fixed or I will fix them myself if someone can enlighten me as to what causes these problems.
        • 1. Re: the dreadful Scene Change and Preloader
          kglad Adobe Community Professional & MVP
          don't use scene information for navigation and don't use the goto functions. use frame number or labels and the goto methods:

          _root.gotoAndPlay("portfolio_frame2"); // <- label this frame
          • 2. the dreadful Scene Change and Preloader
            thanks kglad. I changed it like you said and after it loads it would go to the next frame and stop so I added delete onenterframe to the code and then it would and go tot he next frame and play. Now there is a new problem.

            Now when I RollOut of the buttons and the scene is supposed to change, the scene no longer changes. I think something having to do with OnEnterFrame has voided my RollOut functions. My scene was complex and depends on these for the proper effect. Can you or anyone tell me how to correct this? Please note that the RollOn scene changes still work without problem.

            --Followup--- I commented out the OnEnterFrame related code and i sitll was not able to get the rollout scene changes to work. If I name a frame one time, does that mean all frame numbers in the code become void? Can't be, because the RollOn scene change still works so I am really confused.
            • 3. Re: the dreadful Scene Change and Preloader
              kglad Adobe Community Professional & MVP
              you need to delete your onEnterFrame loop when it's no longer needed.
              1 person found this helpful
              • 4. Re: the dreadful Scene Change and Preloader
                ok, after doing alot of work I see what caused the RollOut functions to stop working. When i added the Prelaoder to the scene I had to Insert A New frame which caused all of my action frames to bump back a number so that the frame numbers where no longer correct. After trying a number of other things, I went back and deleted a frame in most of the layers and this entire scene seems to be playing correctly!

                NOW, back to the original problem. This scene's preloader is working correctly, but the Resume preloader routes immediatly back to the Portfolio page when loading, so I am going to see if I can copy the same preloader script we used in Portfolio and see if we can get passed these problems and move on with the site. Cross your fingers ~ I will update as soon as I have news. Thanks kglad :)
                • 5. Re: the dreadful Scene Change and Preloader
                  Alright, I can't check to see if the prelaoder is working on the scene because the button from the menu screen takes me to the wrong scene every time. This was part of the original problem. The other buttons on the menu page work and take you to the correct scene, but the Resume button takes you either to the Bio page or the Portfolio page. When the entire file is rendered, it works, but when I do Preview or try it online for the FIRST time it goes to the wrong scenes.

                  I have tried changing the scrip for hte button a number of different ways; changing the frame number to the frame name, using only hte frame name, using Global, using Root, actionscripting hte button itself the on (Release) way, I have checked the frames in the scene, the scripts are the exact same for the other menu buttons and the preloader frame is the exact same script as on the Portfolio preloader scene. My scripts contained no errors either. What in God's name can I do?

                  :*( so sad
                  • 6. Re: the dreadful Scene Change and Preloader
                    you can view this at www.danieljkessler.com
                    • 7. Re: the dreadful Scene Change and Preloader
                      kglad Adobe Community Professional & MVP
                      copy and paste the code that's relevant to the problem.
                      • 8. the dreadful Scene Change and Preloader
                        i was going to before but the code page would not load and it still will not load. When I paste it here it doesnt seem to work either. . . .

                        // menu page

                        this.bio_btn_int.onRelease = function() {
                        gotoAndPlay("bio_1", 1);
                        }
                        this.resume_btn.onRelease = function() {
                        gotoAndPlay("resume", "loadresume");
                        }
                        this.prot_btn.onRelease = function() {
                        gotoAndPlay("portfolio", 1);
                        }

                        //first page in resume scene
                        stop();
                        _root.onEnterFrame= function() {
                        var percent:Number = Math.ceil(_root.getBytesLoaded() /
                        _root.getBytesTotal() * 100);
                        preload_txt.text = percent + "% Loaded";
                        ifFrameLoaded("resume", 420) {
                        delete onEnterFrame;
                        _root.gotoAndPlay("startresume");
                        }
                        }



                        • 9. Re: the dreadful Scene Change and Preloader
                          kglad Adobe Community Professional & MVP
                          don't use scene information for navigation and don't use the goto functions. use frame number or labels and the goto methods:

                          fix:

                          this.bio_btn_int.onRelease = function() {
                          gotoAndPlay("bio_1", 1);
                          }
                          this.resume_btn.onRelease = function() {
                          gotoAndPlay("resume", "loadresume");
                          }
                          this.prot_btn.onRelease = function() {
                          gotoAndPlay("portfolio", 1);
                          }
                          • 10. Re: the dreadful Scene Change and Preloader
                            kglad, I am still confused, your "fix" code is the exact same as mine. If I don't use goto and scene information, how do I goto the scene?
                            • 11. Re: the dreadful Scene Change and Preloader
                              kglad Adobe Community Professional & MVP
                              fix that code following the instructions i gave and the instructions you followed to fix the goto function in your preloader.
                              1 person found this helpful
                              • 12. Re: the dreadful Scene Change and Preloader
                                you say not to use goto functions, but to use goto methods. I am arleady using the same code I used in the portfolio preloader. If i remove the scene names, the buttons dont do anything.
                                • 13. Re: the dreadful Scene Change and Preloader
                                  kglad Adobe Community Professional & MVP
                                  do you see a difference between:

                                  gotoAndPlay ("portfolio", 2); // function. using scene info.

                                  and

                                  _root.gotoAndPlay("portfolio_frame2"); // method. using a frame label

                                  can you see that you're using functions and scene information in your other goto's?
                                  • 14. Re: the dreadful Scene Change and Preloader
                                    Thank you. I couldn't get it to work before, but now its working, but it seems the preloader must not be working right. Even though I used the debuger to step through each line of the script, I cannot see why the screen goes black instead of the preloader clock and numbers loading like the portfolio page. It used to work BEFORE i added it to the Portfolio page as well. This is a real mystery to me since it is the same code. What's going on with that?
                                    • 15. Re: the dreadful Scene Change and Preloader
                                      kglad Adobe Community Professional & MVP
                                      don't use the ifFramesLoaded() function. use the _framesloaded property of movieclips:

                                      if(_root._framesloaded == somenumber){
                                      ...
                                      }
                                      • 16. the dreadful Scene Change and Preloader
                                        i found out that you cant put a preloader on each scene, only one time. So that was the problem. Took me a long time to figure out the preloader script to only load partially, so I'll post that here incase someone else has the same problems. Also, for that person, you want to create multiple swf files and load them into the file from the external location. That way you can have a preloader for each scene. A note is to try to avoid scene changes and work within one timeline, and also that scenes load top to bottom unless you change the publishing setting, so if you are only partially loading your movie and find some of the buttons to link to the scene immediately, rearranging the scene download order by dragging the scenes in the scene window in order can help to correct this.

                                        Second, the problems with the scene buttons not working when the file was loading is because they are linking to scenes that have not loaded yet. The preloader helps to fix this. Using the frame name instead of hte scene and frame number usually works but I think flash like consistency. If I use the same button in difference instances, I had to use the same format for the onRelease to work.

                                        I have to say, flash is powerful but its also a huge pain in the ***. Don't fool yourself, CS3 is not all mighty. I can't emphasize enough how easy the hard things were to do and hard the easy things were to do. Flash design is fun, but flash scripting is real sorcery.

                                        Thanks for all of your quick and helpful replies kglad, especially during the holidays. My site can be viewed at www.danieljkessler.com , I still have to do the chinese version, but I plan using the same file and changing and redoing some of the buttons with english. God help me.
                                        • 17. Re: the dreadful Scene Change and Preloader
                                          kglad Adobe Community Professional & MVP
                                          you're welcome.
                                          1 person found this helpful