PDA

View Full Version : preloader problem


Akuma
01-09-2003, 09:11 AM
Ok, i am trying to set up a simple preloader for a flash menu im making. From what i can tell this looks good but it doesnt seem to work.. Im not that great at scripting so maybe someone here can lend me a hand?

On frame ten i have this:

if (_framesloaded>=_totalframes) {
nextFrame();
} else {
gotoAndPlay(5);
}


it doesnt seem to goto the next frame at all, it keeps going back to frame 5. Any idea what im doing wrong?

Ian Jones
01-09-2003, 12:54 PM
Are you sure its not also going back to the frame 0 of the menu swf? Why do you say frame 5?

I don't know much about AS either, but I think you may need to name the movieclip you are referring to, otherwise it may simply be ignoring it because it has an action to do but can't find the right object to apply it to. I'm just guessing, but eh... hopefully it works. :)

Armin
01-09-2003, 01:15 PM
not related maybe, but
try to use Labels insted of frame numbers in actions.

...the correct script is not in my mind right now
i'll check it for you later.

fig
01-09-2003, 03:20 PM
put a stop action on frame 1, everything else on frame 2, and create a blank mc on your stage and add this code to it (on it, like a button, not in it):

(borrowed from bmace's tutorial on preloaders at ultrashock (http://www.ultrashock.com))

onClipEvent (load) {
tkb = _root.getBytesTotal();
}


onClipEvent (enterFrame) {
p = Math.round((_Root.getBytesLoaded()/tkb)*100);
_root.percent = p;

if (p==100) {
_root.nextFrame();
}
}


that should do it...

chris

Akuma
01-09-2003, 05:52 PM
what is a blank mc ?

fig
01-09-2003, 06:01 PM
a movieclip with nothing in it, it'll appear as a white dot. it's basically just an empty symbol to apply an action to. i usually put them just above and to the left of the stage so i know where they'll be.

chris

Akuma
01-09-2003, 09:55 PM
what happens when it is taking a long time to load... will it stay on this 1 frame?

Maxx
01-09-2003, 10:18 PM
It will if your preloader is a separate Movie Clip. Flash loads all frames of every movie clip on the stage before it will begin to play them - I usually create my preloaders in a separate scene (make sure it's the first scene in the file - that one got me for quite a while, actually). You only really need a couple frames, then when your if statement evaluates to true (all frames are loaded), add the gotoAndPlay("nextScene", "start"); where "nextScene" is the name of your main scene, and "start" is the label set up at the beginning of the content.

HTH.

fig
01-09-2003, 10:43 PM
well, if you're preloading a lot then yeah, it'll stay on that one frame :) you might create a very small movie clip and play that as soon as you start loading and stop it/fade it when you're done loading, then you know that while its playing your movie is still loading. i personally never use scenes, they're more of a pain than they're worth imo. check out the tutorial i mentioned earlier here (http://www.ultrashock.com/tutorials/flash5/preloaders.html) for more info on creating and using preloaders.

chris

Maxx
01-09-2003, 11:06 PM
Yeah, I know alot of people who hate scenes - something about the way my brain works, it's not that tough for me. However, I do believe that I am a vast minority in that regard. Anyway - Akuma - definately hit the Ultrashock tuts.

Akuma
01-10-2003, 05:01 AM
wow, thats an excellent site! thanks guys :)

fig
01-14-2003, 03:20 PM
glad to help akuma.

maxx, preloaders are probably the only instance i'd use a scene for, otherwise they're pretty problematic in my experience. i used to use them until i discovered using movieclips, haven't looked back since :) no more worrying about copying graphics from one scene into the last frame or first frame of another scene so everything looks fluid, etc., just have a mc with the content you want and a blank first keyframe on your stage and fire it up whenever you need it. if you haven't tried using them yet give it a shot, its definitely worth the time.

chris

Maxx
01-14-2003, 03:38 PM
I actually found it easier in the past to organize with scenes for main content and preloader. Just happens to be the way my brain works (read - oddly :shrug: ). Anyway, I've got a large site project coming up as soon as I finish the catalog I'm working on, and speed is definately going to be of the essence - both construction and download speed. So I'll play with the pre-loader movie concept. It certainly does sound easier to manage! Thanks for the advice.

fig
01-15-2003, 04:43 PM
glad to, its definitely a better way of doing things once you get it figured out. feel free to drop me an e-mail if you've got any q's.

chris

CGTalk Moderation
01-14-2006, 04:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.