# Simple Preloader Question...No Really It is lol

**URL:** <https://forum.kirupa.com/t/simple-preloader-question-no-really-it-is-lol/11407>\
**Category:** flash\
**Created:** [January 16, 2003, 7:26pm UTC](https://forum.kirupa.com/t/simple-preloader-question-no-really-it-is-lol/11407 "2003-01-16T19:26:03Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matimeo](https://avatars.discourse-cdn.com/v4/letter/m/76d3ee/32.png) [@Matimeo](https://forum.kirupa.com/u/Matimeo)\
**Post date:** [January 16, 2003, 7:26pm UTC](https://forum.kirupa.com/t/simple-preloader-question-no-really-it-is-lol/11407/1 "2003-01-16T19:26:03Z")

</div>

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](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_

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 16, 2003, 8:04pm UTC](https://forum.kirupa.com/t/simple-preloader-question-no-really-it-is-lol/11407/2 "2003-01-16T20:04:54Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 16, 2003, 8:20pm UTC](https://forum.kirupa.com/t/simple-preloader-question-no-really-it-is-lol/11407/3 "2003-01-16T20:20:37Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 16, 2003, 8:27pm UTC](https://forum.kirupa.com/t/simple-preloader-question-no-really-it-is-lol/11407/4 "2003-01-16T20:27:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 16, 2003, 8:41pm UTC](https://forum.kirupa.com/t/simple-preloader-question-no-really-it-is-lol/11407/5 "2003-01-16T20:41:05Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 16, 2003, 8:48pm UTC](https://forum.kirupa.com/t/simple-preloader-question-no-really-it-is-lol/11407/6 "2003-01-16T20:48:28Z")

</div>

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::

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 16, 2003, 8:57pm UTC](https://forum.kirupa.com/t/simple-preloader-question-no-really-it-is-lol/11407/7 "2003-01-16T20:57:11Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 16, 2003, 9:27pm UTC](https://forum.kirupa.com/t/simple-preloader-question-no-really-it-is-lol/11407/8 "2003-01-16T21:27:23Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 17, 2003, 12:13am UTC](https://forum.kirupa.com/t/simple-preloader-question-no-really-it-is-lol/11407/9 "2003-01-17T00:13:18Z")

</div>

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:

```auto
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:

```auto
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:

```auto
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 🙂  
_- Reed morse_
