Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

preloader q 1

Status
Not open for further replies.

help120

Technical User
Apr 15, 2001
198
US
I've 1 main swf that contains the main part of my site. In here I've 2 buttons which load 2 other swf into the main swf. The problem is that the preloader works fine for the main swf but when I try to use the same preloader for the 2 swf that I load into the main swf it some how does not work. Now in all 3 of my swf i've the following preloader.

3 layers:
Top layer "Actions"
Mid layer "preloader mc"
Bottom layer "Main Movie"

Top layer "Actions" has 2 keyframes. First keyframe has the following actions.

ifFrameLoaded (2) {
gotoAndPlay(2);
}


2nd keyframe has the following action.

stop();

Mid layer "preloader mc" has only 1 keyframe in frame 1. In this frame I've a MC that loops over and over again.

Bottom layer "Main Movie" has 1 keyframe located in frame 2. In this frame I've my main movie.

If theirs an easier way of doing this I'm up for ideas. Thank you in advance for your help.

 
Outside of the fact that the ifFrameLoaded action is deprecated, a lot of confusion in your question.

Would be easier to just use a generic preloader in the main movie, and eliminate the ones in your "to be loaded" movies. Regards,

oldman3.gif
 
Ok, since iframeloaded is deprecated then do you know of a good link to a simple preloader that shows just a simple mc until the rest of the movie is downloaded?
 
Remember I'm using the following action to load 2 other movies into my may swf. I will also need to use the same preloader in these swfs.

on (release) {
loadMovieNum("websites.swf", 1);
}
 
Try this... Make your movies 4 frames long.

Frame 1:

if(_root.getBytesLoaded() >= _root.getBytesTotal()){
gotoAndStop(4);
}

Frame 2:

if(_root.getBytesLoaded() >= _root.getBytesTotal()){
gotoAndStop(4);
}

Frame 3:

gotoAndPlay(2);


The first frame is only to prevent seeing a flash frame of the preloader upon a refresh or a subsequent visit to your site when the movie is cached, after the initial download.
This frame should remain clear of any displays. Thus make sure your movie clip on the other layer, is only over frames 2 & 3. Regards,

oldman3.gif
 
And your "MainMovie" is of course on frame 4. Regards,

oldman3.gif
 
I added the preloader to all 3 of my swfs and it works fine when I do "test move/ show streaming" for the main swf. But when I press on web.portfolio it does not show the streaming for that swf. I uploaded it to see if it would show up but my dsl is to fast and it just plays right off.

 
I'm on cable, but just checked it on my 56k dialup. Seems to work, I see your "loading" message mc. Is the top part, part of the main movie, and then the "drop downs" the two others? Regards,

oldman3.gif
 
This is the 2nd preloader you should see after you press on the websites.portfolio button. I just tested this swf in flash and it stays on frame 0 for along time. Then it finaly goes to frame 2 and plays the preloader for like 2-3 sec then jumps to the main movie. If you want I can upload the fla for you.


P.S. How long did it take to load on your 56k?
 
Just tested it again... And I'm not sure your movies ain't streaming still rather than fully downloading before playing.

Get a sort of flash frame in your flower thing, but just realized that your movies seem to hold components, in which case the preloaders wouldn't display correctly until the export on the first frame stuff had downloaded.

Yes it would be better to have a look at the .flas, but can't look into that before tonight.
Can you zip them up, upload them wherever, and provide a link to download them later on? Regards,

oldman3.gif
 
Ok, I sent an e-mail to your hotmail account.
 
Just e-mailed you a couple of .flas with a generic preloader. Regards,

oldman3.gif
 
Hey, thanks for your help on the preloader. I'm not sure about your code in a few places. First in patrickmain should I not have 3 keyframes with the actions you sent me earlier? With the preloader in frame 2 and 3? If so that means I've to move that button, and actions you sent me in the fla over to frame 4.. right?

I'm also confused on some of the code inside the button.

on (release) {
if (_root.current_selection == "webport"){
stop();
} else {
_root.preloader.gotoAndStop(2);
loadMovieNum("patrickwebsites.swf",1);
_root.current_selection = "webport";
}
}

What is webport? Is that an instance? I did notice you had this action in the top frame.

stop();
_root.current_selection = "";
 
Although I would really have to look at your main .fla to confirm it, think you can keep the first preloader code I gave you as is, for the main movie.
You could use the same new preloader code as well but it would have to be modified, because you now want to read the bytes downloaded on _root and not on _level1.

As for _root.current_selection, it's just a variable I set to keep the button from re-loading the movie, if it's already loaded and displayed. Don't know if you've changed it in your own files already, but as of yesterday, if I re-hit web.portfolio on your site, and that movie was already up and displayed, it will re-load again from the start of that movie, and there's really no point to that, since that movie is already up.

In my file, when the button is pressed, I check to see what the current selection is, and if it's the same as the one already loaded, do nothing, or if it's not the then load the according movie. I could of used any value, I used "webport" because it was the "web.portfolio" button that was pressed. In the other buttons, I'd use the same code but would replace the value of current_selection according to the button that was pressed. Thus I could use "artport" for your other button.

Starting to get a better picture?

Send me your main .fla if you want me to adapt the new preloader to it.
Include any special font files you may have used, 'cause if I don't have them, Flash defaults to the nearest font on my system, and that f... up the display.

Regards,

oldman3.gif
 
Doah, I should have taken better care to read the code better.

if (_root.current_selection == "webport")

If I'm right and I would like to think that I'm.. that code checks to see if it's webport. If it's not the following code sends you to frame 2 of the preloader then sets the current_selection to webport.

_root.preloader.gotoAndStop(2);
loadMovieNum("patrickwebsites.swf",1);
_root.current_selection = "webport";

Now I know you said not to take the actions out of frame 2 in the preloader but could you explain to me why?
 
Well if you take out the code, then the movie won't be preloaded and stopped until it has fully downloaded.
You can comment out every line that refers to percent_display, loadbar or reelmc, or simply select those 3 elements on stage and simply delete them, but leave the rest of the code there, otherwise you're not preloading the movie anymore. Regards,

oldman3.gif
 
Ok, I've edited my code the best that I can but again I've the same problem as before.. my connection is to fast. You can view it here You should see a alpha fading text that says loading. Right where the "05" pops up after the swf is loaded. Then when you click on web.port you should see the same loader but down by the "web.sites/portfolio" tab. If it does not show up I will upload the fla.
 
I do see the first one, though I'm not convinced it's working properly, because I do see the top part of your site appear long before the rest does, giving the impression your movie is streaming rather than preloading.

As for the second one, I don't see it.

When this is what I should be seeing:


Although on a fast connection this goes pretty fast also. Regards,

oldman3.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top