# Preloader question

**URL:** <https://forum.kirupa.com/t/preloader-question/59558>\
**Category:** Uncategorized\
**Created:** [August 2, 2004, 1:25am UTC](https://forum.kirupa.com/t/preloader-question/59558 "2004-08-02T01:25:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![cowboy71](https://avatars.discourse-cdn.com/v4/letter/c/cc9497/32.png) [@cowboy71](https://forum.kirupa.com/u/cowboy71)\
**Post date:** [August 2, 2004, 1:25am UTC](https://forum.kirupa.com/t/preloader-question/59558/1 "2004-08-02T01:25:29Z")

</div>

Hey,  
I had a friend animate a nice bug walk cycle. all I want to do is have the bug follow the preload bar when loading up. I have an idea of how, but not sure how to impliment it. I was thinking I could create 100 frames of the bar progressing, then have the spider following it and checking to see if the site has loaded. I need the bug to stop if the bar stops and I need them to reach the end together.  
Hope someone can help, or point me in the right direction.  
This is my last hurdle for the site.  
Thanks a bunch.

---

<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:** [August 2, 2004, 3:57am UTC](https://forum.kirupa.com/t/preloader-question/59558/2 "2004-08-02T03:57:55Z")

</div>

hmmm do you want it to be a true preloader? because if you want it to really be in sync with the load progress of your site, movie, game, whatever it may be, you need to program it to move across in sync with the load progress. if you just animate the whole thing frame by frame you arent really making a “preloader”… just an animation to keep the person occupied while the real loading happens. if you want to do it so that the bug arrives at the final destination like you want, then you should probably code the movement of your bug walking.

hope this made sense to you.

sambo

---

<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:** [August 2, 2004, 5:35am UTC](https://forum.kirupa.com/t/preloader-question/59558/3 "2004-08-02T05:35:46Z")

</div>

> [@cowboy71](#):
>
> Hey,  
> I had a friend animate a nice bug walk cycle. all I want to do is have the bug follow the preload bar when loading up. I have an idea of how, but not sure how to impliment it. I was thinking I could create 100 frames of the bar progressing, then have the spider following it and checking to see if the site has loaded. I need the bug to stop if the bar stops and I need them to reach the end together.  
> Hope someone can help, or point me in the right direction.  
> This is my last hurdle for the site.  
> Thanks a bunch.

Just made this very quickly  
[http://www.gifsrus.com/testfile/basicpreloader.swf](http://www.gifsrus.com/testfile/basicpreloader.swf)  
heres the code i used

stop();  
bar.\_width = 0;  
assessLoad = function (clip) {  
var kbLoaded = Math.floor(clip.getBytesLoaded()/1024);  
var kbTotal = Math.floor(clip.getBytesTotal()/1024);  
percent = kbLoaded/kbTotal;  
bar.\_xscale = percent_100;  
percent\_txt.text = Math.floor(percent_100)+“%”;  
if ((kbLoaded == kbTotal) && kbTotal\>1) {  
clip.gotoAndStop(2);  
clearInterval(myInterval);  
}  
};  
spider.onEnterFrame = function() {  
this.\_x = bar.\_x+bar.\_width;  
ladybird.\_x = this.\_x+50;  
};  
myInterval = setInterval(assessload, 50, this);

I just hope your spider is a little better than mine.

---

<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:** [August 2, 2004, 5:41am UTC](https://forum.kirupa.com/t/preloader-question/59558/4 "2004-08-02T05:41:59Z")

</div>

Here is the same idea as stringy’s, just a little shorter (i believe it was Jbum that helped with this):  
[AS]  
getRatio = this.getBytesLoaded()/this.getBytesTotal();  
this.loadBar.\_width = getRatio_157;  
mc.\_x = loadBar.\_x + loadBar.\_width;  
loadText.text = Math.floor(getRatio_100) + ‘%’;  
if (getRatio == 1) {  
this.gotoAndPlay(3);  
}  
[/AS]

---

<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:** [August 2, 2004, 6:01am UTC](https://forum.kirupa.com/t/preloader-question/59558/5 "2004-08-02T06:01:41Z")

</div>

Yes, indeed, you can do it… Follow me!!!

I hope you are having the basic idea about movieclips and timelines.

I explain the details in terms of the attachment with the thread.

Inorder to accomplish this we’ve two scenes.

The first scene is "preloader"  
second scene is “memories”

In the first scene you can see the two frame with the status bar and other frame containing the sctipt.

The script on the first frame is,

[COLOR=Sienna]totalbytes= \_root.getBytesTotal();  
loadedbytes = \_root.getBytesLoaded();

\_root.percentdone = int ((loadedbytes/totalbytes)\*100); //Calculate the percent done

\_root.bar.gotoAndStop(percentdone); //The timeline moves to the value out of 100

ifFrameLoaded (“memories”, 1){ //Check the memories frame loaded or not; if loaded goto and Stop to the first frame of memories  
gotoAndStop(“memories”, 1);  
}[/COLOR]

* * *

In the memories scene we’ve converted to objects to reduce the main timeline into a single frame

Hope this will helpful for you… Cheers :p:
