Preloader question

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.

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

Just made this very quickly
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 = percent100;
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.

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 = getRatio157;
mc._x = loadBar._x + loadBar._width;
loadText.text = Math.floor(getRatio
100) + ‘%’;
if (getRatio == 1) {
this.gotoAndPlay(3);
}
[/AS]

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: