View Full Version : Preloader giving trouble
rachna
02-08-2005, 06:48 PM
Hi
could someone please tell me what the right action script is - for a simple preloader ? my preloader seems to do it's own thing, and doesn't show when the movie has loaded. In other words, once my pre-loader shows up, one can go make one'self a cup of coffee, have a snack, have a chat etc. etc. and come back, it still show loading. What is it that I'm doing wrong ?
Rachna
Hi,
Post some sample code of how you have your preloader set up. There are many different ways to code a preloader but for the most part it is just a matter of checking getBytesLoaded to see if it is equal to getBytesTotal. Example3 frame preloader......
Frame 1...
//you could leave this code out and make it a 2 frame preloader
//but I like having the extra check
ifFrameLoaded (2) {
gotoAndPlay(2);
}
Frame 2...
total = int(_root.getBytesTotal());
download = int(_root.getBytesLoaded());
if (total == download) {
_root.gotoAndPlay("mainstart");
} else {
play();
}
Frame 3...
gotoAndPlay(2);
Hope it helps
NTD
rachna
02-10-2005, 11:18 PM
Hey that worked ! Thanks a ton. Had to work on it a bit, but figured it out finally.
Thanks again
Nartiq
04-07-2005, 05:29 AM
I've also been having problems with a preloader....
My movie has 12 scenes right now and for whatever reason i can't get a preloader to load all of them at once
The code posted above doesn't work, do I need something else to make sure it loads all of the scenes??
Hi,
A preloader is not responsible for the loading of content. It is merely an indicator to the user that the content has loaded or how much of the content has loaded. When you call an .swf or html page with an .swf file embedded, the browser will download the full contents of the file whether a preloader is in place or not. The code above works well in most situations. There are a few known issues with using preloaders. One is if your using export for actionscript with attachMovie. Another is using Flash components, which export thier actionscript in the first frame. Both of these issues deal with the content having to fully load on frame one of the movie before any other content(including preloader code) can fire. This issue is usually noticeable by the preloader not appering visually until 50% or more of the file has downloaded. Is this the problem your experiencing?
NTD
Nartiq
04-07-2005, 12:47 PM
the problem is that _root.getBytesLoaded seems to only be returning how many bytes it has loaded of the preloader scene and the same thing for _root.getBytesTotal
because the preloader scene is actually very small the preloader itself just flashes up and is gone and the movie plays right away
i tried to export my movie minus the preloader and then impre that as a movie clip into another swf that contain the same preloader. the problem i got there was that for whatever reason the sounds didn't import along with the rest of the movie
Hi,
When you add scenes in flash, it is basically like extending the main timeline. Flash actually counts total frames, not scenes. _root.getBytesTotal returns the size value for all content on all frames. One thing to keep in mind is when testing a preloader, it should be done in an online environment. Flash author mode will connect to a local file too quickly for a preloader to be effective. This is also an issue with broadband connection speeds. If there in not much content, the preloader will never be seen. Try creating a test movie with the code above. To ensure the content is a sufficient amount, use any avi video imported into a flash movie. Post the preloader code on the top scene, upload it to your website and test it. I make extensive use of this method with my MP3 player. The sounds that stream use this method to show the user how much of the sound has loaded. I also use this method to preload .jpg images for the album covers. Here is a demo.....
http://ntdesigns.net/ntPlayer/GroupyBandMate.swf
With that said....... a little rant about using scenes. The real power of Macromedia Flash is the movieclip object. Anything that can be put in a seperate scene, can be contained in a single movieclip. Movieclips have thier own independent timeline and properties. The advantage of organizing content with movieclips instead of scenes is apparent in editing. It is much easier to manage content on a single timeline as opposed to switching back and forth between scenes to edit content. Scenes are notorious for dropping variable values. This is hard to explain or give a demo, but on occasion, a variable value will simply become null when switching between scenes. An example of movieclip simplification of a scene project would be ..... a 12 scene flash movie...... each scene converted to a single movieclip residing on the main timeline.... would make the project a 12 frame single timeline with a movieclip on each frame containing the "scene". Editing becomes centralized and you can see everything in the project without searching scenes.
NTD
Powered by vBulletin™ Version 4.1.1 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.