PDA

View Full Version : Percentage display preloader not comprehensive


ProtoC
06-06-2006, 08:23 PM
I am using this widely available simple preloader code to display a percentage count of my movie:

bytes_loaded = Math.round(_root.getBytesLoaded());
bytes_total = Math.round(_root.getBytesTotal());
getPercent = bytes_loaded/bytes_total;
percentor.text = Math.round(getPercent*100)+"%";

There is code that checks if the movie is loaded and send the playhead to the start but thats the main chunk we all know and love.

The problem is that it only displays "75%" than "100%" but nothing before or in between. Is there a better way to make a percentage pre-loader, that you literally see going from 1% to 100%?

Navarone
06-09-2006, 08:58 PM
Are you seeing this only when you publish your movie or have you seen this from across the web?

lattasource
06-11-2006, 01:45 PM
you have to make sure that nothing except the preloader is on the first frame. You also need to check any componets you are using and uncheck "export in first frame" in the linkage options. Then in your publish settings under the flash tab, click settings and set "export frane for classes" to 2 so all that code is not dumped on the first frame. Are you using a normal flash setup or are you using slides/form setup?

Also use this code instead of a frame loop


stop();
this.onEnterFrame = function(){
bytes_loaded = Math.round(_root.getBytesLoaded());
bytes_total = Math.round(_root.getBytesTotal());
getPercent = bytes_loaded/bytes_total;
percentor.text = Math.round(getPercent*100)+"%";
if(bytes_loaded == bytes_total){
gotoAndPlay(2)
delete this.onEnterFrame;
}
}

ProtoC
06-19-2006, 06:35 AM
That last bit of code and changing the linkage on components did the job !! Excellent and thanks!