PDA

View Full Version : Pre-loader that runs in time with the download.



Simon
03-30-2005, 02:27 PM
I've made a pre loader that is a circle that turns like the hands of a clock (really original). I would like it to run once, and when the clock is full the movie has loaded. How can I script the loader to run in time with the download speed of the end user?

Also

There is a second part of the site, it is a completly seperate flash file (for various reasons) and I would like to pre load the second movie whilst the first is running, is this possible, or will the (second) movie start loading from scrach again once the second movie has been activated?

Thanks in advance.

NTD
03-30-2005, 04:23 PM
Hi,

You could use the getBytesLoaded/getBytesTotal to rotate the position of your "clock arms". Here is a simple actionscripted preloader..



_root.createEmptyMovieClip('preLoader', 10000);
_root.preLoader.onEnterFrame = function() {
var percent = _root.getBytesLoaded()/_root.getBytesTotal();
if &#40;percent<1&#41; &#123;
trace&#40;Math.round&#40;percent*100&#41;+" % Completed"&#41;;
_root.status.text = "Loading..."+Math.round&#40;percent*100&#41;+" %";
&#125; else &#123;
delete _root.preLoader.onEnterFrame;
_root.status.text = "";
&#125;
&#125;


This is just a simple preloader that displays the percent loaded in a textfield. To manipulate the position of your arms, you could do it with actionscript, or you could use a motion tween and play the motion tween based on the percent loaded.Example...... a 100 frame movieclip....


myMC.onEnterFrame=function&#40;&#41;&#123;
this.gotoAndStop&#40;percent*100&#41;;
&#125;


hope it helps
NTD