# My preloader isn't working!

**URL:** https://forum.kirupa.com/t/my-preloader-isnt-working/16298
**Category:** Uncategorized
**Created:** [March 23, 2003, 10:25am UTC](https://forum.kirupa.com/t/my-preloader-isnt-working/16298 "2003-03-23T10:25:02Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![955](https://avatars.discourse-cdn.com/v4/letter/9/4bbf92/32.png) [@955](https://forum.kirupa.com/u/955)
#### Post date: [March 23, 2003, 10:25am UTC](https://forum.kirupa.com/t/my-preloader-isnt-working/16298/1 "2003-03-23T10:25:02Z")

</div>

[AS]total\_bytes = root.getBytesTotal();  
loaded\_bytes = root.getBytesLoaded();  
percent\_done = int((loaded\_bytes/total\_bytes)\*100);  
Preloader.gotoAndStop(percent\_done);  
ifFrameLoaded (“Main”, 1){  
gotoAndPlay (“Intro”, 1);

trace (percent\_done)  
}[/AS]

This is the actionscript I have in my preloader. (I only added the trace when I found out it wasn’t working.) The movie clip ‘Preloader’ is my bar.  
The trace function returns 0 every time I run the clip, and the preloader bar stays still. Anyone know why this doesn’t work?

---

<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: [March 23, 2003, 10:36am UTC](https://forum.kirupa.com/t/my-preloader-isnt-working/16298/2 "2003-03-23T10:36:26Z")

</div>

remember that you have to loop the movie so the action is continually executed.

**ie.** if you have the script at frame 1, you should have a _gotoAndPlay(1);_ at frame 2.

however… i’d suggest to check out the tutorials about preloaders in the site 😉 =)

---

<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: [March 23, 2003, 12:15pm UTC](https://forum.kirupa.com/t/my-preloader-isnt-working/16298/3 "2003-03-23T12:15:15Z")

</div>

I have got gotoAndPlay(1); in my second frame. Its really strange how it doesn’t work:( . I got the preloader code of [actionscript.org](http://actionscript.org). Still, I’ll try the tutorial here incase I missed something…

---

<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: [March 23, 2003, 12:21pm UTC](https://forum.kirupa.com/t/my-preloader-isnt-working/16298/4 "2003-03-23T12:21:50Z")

</div>

well, i really don’t think it’s causing the problem… but i just wanted to let know that _ifFrameLoaded_ has been deprecated since flash 5. :-  
i think _int_ too… i’d need to check that out. :sigh:

good luck with the tutorials. 😉 =)

---

<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: [March 23, 2003, 12:33pm UTC](https://forum.kirupa.com/t/my-preloader-isnt-working/16298/5 "2003-03-23T12:33:10Z")

</div>

by the way, here’s my zip:

[start1.zip: 1.3 MB](http://www.skehin.com/start1.zip)

thanks a lot for your help so far!

EDIT: It does transfer me when the frames I specify are loaded, but the bar is static.

---

<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: [March 23, 2003, 12:46pm UTC](https://forum.kirupa.com/t/my-preloader-isnt-working/16298/6 "2003-03-23T12:46:39Z")

</div>

😛 until i saw the code in your file i noted this little mistake

```auto
total_bytes = **root**.getBytesTotal();
loaded_bytes = **root**.getBytesLoaded();

```

should be **\_root** 😉

and you forgot the instance name in the movie clip of the bar :-\

try that… i really didn’t test it. i’m kinda busy right now ☹  
i have a lot of work to finish :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: [March 23, 2003, 12:53pm UTC](https://forum.kirupa.com/t/my-preloader-isnt-working/16298/7 "2003-03-23T12:53:55Z")

</div>

oh! here’s another thing i saw just before closing flash… =)

```auto
percent_done = Math.round((total_bytes/loaded_bytes)*100);

```

should be

```auto
percent_done = Math.round((loaded_bytes/total_bytes)*100);

```

it’s not the same 10/5 than 5/10 😉

---

<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: [March 23, 2003, 1:03pm UTC](https://forum.kirupa.com/t/my-preloader-isnt-working/16298/8 "2003-03-23T13:03:07Z")

</div>

Thanks a lot kax, you da man for the next milennium!!🙂

EDIT: Fine kax, you got your way:)

---

<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: [March 23, 2003, 1:06pm UTC](https://forum.kirupa.com/t/my-preloader-isnt-working/16298/9 "2003-03-23T13:06:10Z")

</div>

no problem =)

and… only for today? 😛 😉
