Skip to main content
December 24, 2008
Answered

the dreadful Scene Change and Preloader

  • December 24, 2008
  • 17 replies
  • 926 views

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.
This topic has been closed for replies.
Correct answer
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 ass. 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 replies

kglad
Community Expert
Community Expert
December 28, 2008
you're welcome.
Correct answer
December 28, 2008
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 ass. 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.
kglad
Community Expert
Community Expert
December 27, 2008
don't use the ifFramesLoaded() function. use the _framesloaded property of movieclips:

if(_root._framesloaded == somenumber){
...
}
December 26, 2008
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?
kglad
Community Expert
Community Expert
December 26, 2008
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?
December 26, 2008
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.
kglad
Community Expert
Community Expert
December 26, 2008
fix that code following the instructions i gave and the instructions you followed to fix the goto function in your preloader.
December 26, 2008
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?
kglad
Community Expert
Community Expert
December 26, 2008
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);
}
December 26, 2008
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");
}
}