-
Help with preloader
Hi guys!
I made a preloader for my site, and it's working.
Now I just need to fine-tune it to my liking and I'm not sure how to do it.
I need my preloader to do two things that it isn't doing:
- Force showing all the numbers from 0 to 100(It stops earlier, depending on user's connection);
- Show the preloader immediately once the user enters the site(the preloader only appears after reaching 20% loaded or so).
I think this should be easy for some people here. Thanks in advance!
If you need to see it check it out:
www.drummerfreak.cjb.net
-
Senior Member
where is yo upreloader located?..and what is it trying to preload? is it an external.swf thats ts trying to get the percentage of?
-
No, the preloader is a scene, and the site is in the next scene...
The preloader is a Movie Clip with this code:
Code:
onClipEvent (load) {
tot = _root.getBytesTotal()/1000;
total = Math.round(tot)+"K";
}
onClipEvent (enterFrame) {
down = _root.getBytesLoaded()/1000;
download = Math.round(down)+"K";
bytes = (_root.getBytesTotal()-_root.getBytesLoaded())/1000;
bytesleft = Math.round(bytes)+"K";
per = _root.getBytesLoaded()/_root.getBytesTotal()*100;
percent = Math.round(per);
}
-
-
Senior Member
hi..sorry..on my way out (home form work)
you can try to export your movie / linkage to be in first frame..or for AS (not sure of the options)
the reason you preloader is NOT showing up immediately is because the preloader is IN the same file you trying to preload.... by default a certian amount of a flahs movie HAS to be downloaded before ANYTHIGN can be shown (which inclueds your preloader)..so when it CAN finally display something...you have already downloaded 20% (which is what your preloader reflects when it becomes visible)
-
hm...
But still, there should be a way to make the counter start from 0 even when it's loaded more than that...even it if appears racing from 0 to 20, I don't care as long as it shows all numbers from 0 to 100...
-
Or maybe some kind of speed average function to make it progress smoothly, using the same time interval from 0 to 100?
-
-
Senior Member
_root.getBytesLoaded
your checking to see how much is loaded of your total....unless you want to subtract.
did you try to export in first frame for AS?
-
I just want the % to go from 0 to 100 without skipping any numbers...
-
Senior Member
have you tried the things mentioned here? and just because you may not SEE all the numbers..doesnt mean they didnt show...its as fast as it loads.
-
You might be able to use a easing script, make the loaded bytes the new x coordinat and have the bar move to that point. Are you usine a change in _x for the bar or a change in scale? Either way, and easing function like
var cX:Number = this._x;
var nX:Number = per;
onEnterFrame=function(){
-
sorry lets continue.
onEnterFrame=function(){
var distX:Number=(cX-nX)*0.9;
if(this._x!=nX){
-
Senior Member
-
sorry lets continue.
onEnterFrame=function(){
var distX:Number=(cX-nX/3)*0.9;
if(this._x!=nX){
this._x+=distX;
}else{
this._x=nX;
}
Its pretty simple, you can make it more complicated if you want.
If you want the load bar to remain for a short period there was an example in the actionscript bible that used setInterval instead of onEnterFrame and uses conditional statements that start a counter once the percentage has reached 100%, when the counter equals a certain value the movie jumps forward on the timeline to the next section containing all the homepage.
Actually there are sooooo many ways to do a preloader that you need to do some experimenting to find out what works best for your site. You can also use the progress bar component.
Good luck.
-
Actually there is no progress bar...I just want the numbers...
-
What if you put the preloading script on the second frame of the preloader mc and then create a variable that will store the number of bytes loaded at that stage and then deduct them from the total bytes when you are doing your percentage calculations.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|