# I've just about broken MY HEAD!

**URL:** <https://forum.kirupa.com/t/ive-just-about-broken-my-head/7556>\
**Category:** Uncategorized\
**Created:** [November 2, 2002, 10:32pm UTC](https://forum.kirupa.com/t/ive-just-about-broken-my-head/7556 "2002-11-02T22:32:10Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![nipp2002](https://avatars.discourse-cdn.com/v4/letter/n/e5b9ba/32.png) [@nipp2002](https://forum.kirupa.com/u/nipp2002)\
**Post date:** [November 2, 2002, 10:32pm UTC](https://forum.kirupa.com/t/ive-just-about-broken-my-head/7556/1 "2002-11-02T22:32:10Z")

</div>

OK well . . . . i’ve preloaded the clip but now it starts at 21% . …  
I even traced it and it doesn’t start outputing anything till 21.  
? Anything wrong w/ this code ?

```auto
 
onClipEvent(load) {
	_root.displayText = "0";
}

onClipEvent (enterFrame) {
	bytesLoaded = _parent.getBytesLoaded()
	bytesTotal = _parent.getBytesTotal()
	percentloaded = Math.round(100*bytesLoaded/bytesTotal);
	trace(percentloaded);
	_root.displayText = "Loading: "+percentloaded+"%";
	if (bytesLoaded == bytesTotal) {
		_root.gotoAndStop(2);
	}
}

```

---

<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:** [November 2, 2002, 11:10pm UTC](https://forum.kirupa.com/t/ive-just-about-broken-my-head/7556/2 "2002-11-02T23:10:58Z")

</div>

yeah…it would depend on which way you’re preloading…if you are using getBytes then it should work…but with framesLoaded it would depend…i couldn’t open the file…what are u using to preload?

---

<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:** [November 2, 2002, 11:37pm UTC](https://forum.kirupa.com/t/ive-just-about-broken-my-head/7556/3 "2002-11-02T23:37:22Z")

</div>

yeah its using getBytesLoaded() and its from some tutorial around here… you couldn’t open the file? its in flash mx thats weird.

---

<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:** [November 3, 2002, 12:10am UTC](https://forum.kirupa.com/t/ive-just-about-broken-my-head/7556/4 "2002-11-03T00:10:35Z")

</div>

I see you are using the preloader component (yuk).

Anywho, How do you know it isn’t working? What did you use to test it?

If the file is being read off of your computer it, is fully loaded to start with, so it skips the preload.

You will have to upload it to a server and test it out there. I usually add a medium sized .mp3 to boost the file size and test. Loops don’t add enough to the loading time, so I use short songs. In my opinion is is a great method to test how good your preloader is.

---

<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:** [November 3, 2002, 6:26am UTC](https://forum.kirupa.com/t/ive-just-about-broken-my-head/7556/5 "2002-11-03T06:26:55Z")

</div>

anyone ? 🙂

---

<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:** [November 3, 2002, 6:34am UTC](https://forum.kirupa.com/t/ive-just-about-broken-my-head/7556/6 "2002-11-03T06:34:33Z")

</div>

There seem to be a lot of problems with the preloader component starting late. That is why I said Yuk earlier.

I don’t know how to fix it. I just don’t use it, avoids the problem quite easily :beam:

---

<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:** [November 3, 2002, 6:40am UTC](https://forum.kirupa.com/t/ive-just-about-broken-my-head/7556/7 "2002-11-03T06:40:44Z")

</div>

that code above isn’t using the preloader component 😑

i’m pissed, everyone seems to have problems w/ preloaders i’ve tried about 5 different ways and none work… my main movie works just fine w/ the component preloader but these seperate galleries refuse to be preloaded. ☹

---

<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:** [November 3, 2002, 6:48am UTC](https://forum.kirupa.com/t/ive-just-about-broken-my-head/7556/8 "2002-11-03T06:48:50Z")

</div>

If this helps, I make all my preloaders with this code, and they never fail…

Frame 1…

```auto
bytes_loaded = Math.round(_root.getBytesLoaded()/1000);
bytes_total = Math.round(_root.getBytesTotal()/1000);
_root.loadBar._width = bytes_loaded/bytes_total*100;
_root.loadText = Math.round((bytes_loaded/bytes_total)*100)+"%";
if (bytes_loaded == bytes_total) {
	gotoAndPlay(3);
	delete bytes_loaded;
	delete bytes_total;
}

```

Frame 2

```auto
gotoAndPlay(1);

```

This assumes the load bar you have has the instance name of loadBar and the textbox with the % loaded info has the var name loadText.

The 100 at the end of the \_root.loadBar line defines the finishing width you want your load bar to be.

---

<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:** [November 3, 2002, 6:57am UTC](https://forum.kirupa.com/t/ive-just-about-broken-my-head/7556/9 "2002-11-03T06:57:54Z")

</div>

haha wow lostinbeta 🙂  
thanks a million, its working :nerd:

---

<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:** [November 3, 2002, 7:00am UTC](https://forum.kirupa.com/t/ive-just-about-broken-my-head/7556/10 "2002-11-03T07:00:50Z")

</div>

I am glad I could help.

I am going to put that in a tutorial for Kirupa to add yet another preloader tutorial to this site (he has like 3 already). So you just got an early glimpse 😛
