Simple Preloader Question...No Really It is lol

Im pretty new to flash…I must say and me and my teacher are trying to figure out preloaders. Now what I did was use the kirupa tutorial on making a preloader that shows in text the number of bytes loaded,etc. After that is done I want it to go to the next scene. So I set all that up. The problem is I dont see the bytes loading up…all I see is a blank white screen. Cant figure out why and neither can my teacher. Attached my .fla of course
Any insight is appreciated.

.fla is here:

http://matimeo-ublaz.tripod.com/heitz.html

You have to visit that webpage since I couldnt upload it here and they wont let you access files without being on the tripod server 1st sigh

if you are attempting to preview the preloader from your computer, you won’t see it due to the fact that it is loaded locally. It is already loaded, and therefore skips the preloader entirely. To test the preloader, make sure you have a large graphic in your movie, so there is something to load, and then in flash, hit Ctrl + Enter twice. One will take you to the Movie Preview, and the second will simulate downloading the movie via modem. (bandwidth profiler or something like that)

Hope this helped you out some…

I did that and got nothing but a blank white screen. I also uploaded it to a server and got nothing but a blank white screen. The preloader should preload the whole movie right? Not just the scene its in? My main scene is where the bulk of my movie is. On the preloader scene there is just the preloader itself and frame 2 simply has a framscript telling it to go to the next scene.

I’m totally shooting from the hip here cause I’m not really familiar with FlashMX Actionscripting yet, but…

In previous Flash versions, you would create a loop that keeps on updating the info until it finishes loading and then exits the loop. I’m not seeing a loop in your code, plus you only have two frames.

Also, your file is only 6.5K - not much to preload. It would just be a blink of an eye.

This is the code used. Right from Kirupa’s tutorial:

onClipEvent (enterFrame) {
var bytes = _root.getBytesTotal();
var bytes_loaded = _root.getBytesLoaded();
if (bytes_loaded == bytes) {
_root.gotoAndPlay(2);
this.kirupatxt = “movie loaded”;
} else {
_root.gotoAndStop(1);
this.kirupatxt = “loading (” + bytes_loaded + “/” + bytes +")";

}

}

From my understanding the loop is basically the else if statement.
When I export my movie its 80 kb.

Delete the layer called main1 in your preloader scene. (click on the frame with the little ‘a’, and then click delete, leaving a blank keyframe. Then export your movie.

Don’t ask me why this works, but i just tried it, and it did. Perhaps someone else can identify the problem?

Any Actionsripting Guru’s Lurking? ::looks for Osama bin Lost-in Beta::

So delete the whole layer called main1? or just replace frame 2 of main1 with a blank keyframe?

sorry that was kinda confusing. Either or will work. as long as there is a blank keyframe in frame 2. So, again, either remove the actionscript for frame two, or delete the second layer altogether…

Ok, we get a lot of questions about pre-loaders here at the forum, and that’s cool. Lemmy just write something up for you really quick…

Make a new scene. Name it something like “load”. In this scene there is already a layer. Put all of your good stuff (graphics, etc…) in this layer. Or make new layers and put stuff there. It doesn’t matter.
Next, make a new layer on top of everything else, or on the absolute bottom of everything else. Name this layer “actions”. So far there is only one frame in this scene, so click the next blank frame, frame 2, and push F6. This creates a new frame. For all of your other graphics, push F5 on frame 2 of their layers. Ok? Now go back to the second frame on your actions layer. Select the second frame and bring up the actions panel. Type the following code into this frame:

gotoAndPlay(1);

[SIZE=1]* Note - All actions should be writin in the Expert mode.[/SIZE]
Ok. Now go back to the first frame of the actions layer. Select the first frame and again bring up the actions panel. Type/paste the following code into this frame’s actions:

bytesloaded = Math.ceil(_root.getBytesLoaded()/10);
bytestotal = Math.ceil(_root.getBytesTotal()/10);
_root.loadText1 = ""+bytestotal+"
"+Math.ceil(bytestotal/10);
_root.loadText2 = ""+bytesloaded+"
"+Math.ceil(bytesloaded/10);
if (bytesloaded == bytestotal) {
	_root.gotoAndPlay(3);
}

Ok. I will explain this later. Now, go to a layer, any layer, and add a couple of text boxes, dynamic style. Give the first text box the Var name loadText1 . Now give the second text box the Var name loadText2 . Type some random characters inside these text boxes, like 6 letters or so. Don’t worry about what it says.
Now go and add another frame to the scene, frame 3. In the actions layer for this frame, add the following code to the actions panel:

gotoAndPlay("main", 1);

main is the name of your main scene.

Ok, now to dissect the scripts.
bytesloaded = Math.ceil(_root.getBytesLoaded()/10);
bytestotal = Math.ceil(_root.getBytesTotal()/10);

This declairs two variables, called bytesloaded and bytestotal. The ActionScript (AS) tells the movie to get the bytes loaded ( _root.getBytesLoaded() ) and divide the number by 10 ( /10 ). This is to make the number a decimal place smaller. It just looks good, you can take the ( /10 ) out. Then the code rounds this number up using Math.ceil.
_root.loadText1 = “”+bytestotal+"
“+Math.ceil(bytestotal/10);
_root.loadText2 = “”+bytesloaded+”
"+Math.ceil(bytesloaded/10);

The AS takes the two variables, and prints them into the text boxes you have made. NOTE - Make sure that your text boxes have a ** Var**iable name, not an instance name.
if (bytesloaded == bytestotal) {
_root.gotoAndPlay(3);
}

A simple if statement, saying that if the variable bytesloaded is equivalent to bytestotal, then the _root (timeline of the movie) should go to, and play at frame three.
<br>

  • Hope this helps, if you need more help just ask :slight_smile:
    - Reed morse