PDA

View Full Version : preloading twist!


Simon Turner
04-22-2003, 11:09 AM
Hi

The coding below works fine for preloading the entire .swf before making it available within the main presentation, but occassionally I have need to only preload half the content because by the time the main presentation has called up and gone through its 'launching' sequence - the rest of the .swf has time to load, so to make the loading faster, how would I go about altering the code to do just this?

//this preloader is in a .swf that is called up via the main .swf at the very start and put on 'hold' until it called into action by the viewer with a button press/release.

total_bytes = _root.getBytesTotal();
loaded_bytes = _root.getBytesLoaded();
percent_done = int((loaded_bytes/total_bytes)*100);
var loadAmount = _totalframes;
if (_framesloaded == loadAmount) {
gotoAndPlay(3);
_level0.nextFrame();
}

I would also like to keep the % counter, but give the illusion that when it says 100% loaded, actually only 50% has. :confused:

Thanks for your time to read this, I am sorry I dont make many posts, but I am rather basic in my knowledge and all the easy questions are already answered by the time I see them. Still, next time this question is posted, maybe I can help out too :)

jayouk
04-23-2003, 07:39 AM
I would think you would use

if (_framesLoaded == 50) {

_root.gotoAndPlay(3);
}


Just substitute _totalframes for a number of frames

farafiro
04-23-2003, 08:49 AM
try this
total_bytes = _root.getBytesTotal();
loaded_bytes = _root.getBytesLoaded();
percent_done = Math.round((loaded_bytes/total_bytes)*100);
if (loaded_bytes>= (total_bytes/2)) {
//either chose one of these two lines
gotoAndPlay(3);
// _level0.nextFrame();
}

Warrior
04-23-2003, 08:43 PM
Hey farafiro,
why did you divide by 2 in this line,

if (loaded_bytes>= (total_bytes/2)) {

Simon Turner
04-24-2003, 09:20 AM
thanks for the responses - I shall try them all and post which had the best results .

:) :)

farafiro
04-29-2003, 06:20 AM
Originally posted by Warrior
Hey farafiro,
why did you divide by 2 in this line,
if (loaded_bytes>= (total_bytes/2)) { for this line that Simon wrote:I would also like to keep the % counter, but give the illusion that when it says 100% loaded, actually only 50% has.

Simon Turner
05-01-2003, 02:47 PM
Hello again

The code does indeed make the counter finished when 50% of the .swf is loaded, but the counter only counts to 50% when really I would like to give the impression that 100% has in fact been loaded.

I used farafiro's coding.

This is the url of the site in question:

www.fourseasonscraftfayres.co.uk (http://)

farafiro
05-04-2003, 06:23 AM
Originally posted by Simon Turner
Hello again
The code does indeed make the counter finished when 50% of the .swf is loaded, but the counter only counts to 50% when really I would like to give the impression that 100% has in fact been loaded. u can change that in the preloader bar or the preloader text
just Math

jaredly
05-06-2003, 03:30 PM
total_bytes = _root.getBytesTotal()/2;
loaded_bytes = _root.getBytesLoaded();
percent_done = int((loaded_bytes/total_bytes)*100);
if (_loaded_bytes == total_bytes) {
gotoAndPlay(3);
_level0.nextFrame();
}

Give this a try.