English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I've done some before and the loading screen only appears when it's reached something ridiculous like 90% (which is no use to the user)

http://www.stevebob.com

You'll notice no loading screens...

2006-06-20 09:02:04 · 4 answers · asked by Anonymous in Computers & Internet Programming & Design

4 answers

Usually I do my preloader for flash like this:

Scene: Preloader (Frame 1)
=====================================
loaded_bytes = _root.getBytesLoaded();
total_bytes = _root.getBytesTotal();
percent_done = int((loaded_bytes/total_bytes)*100);
loadpercent = _root.getBytesLoaded()/_root.getBytesTotal()*100;

if (loadpercent != 100) {
percentageTextField.text = int(loadpercent) + '%';
bar.gotoAndStop(int(loadpercent));
} else {
gotoAndPlay("main", 1);
}
=====================================

I place that in my first frame in the preloading scene and the scene has two frames. It loops (1 -> 2, then repeat). In the second frame it has this:


Scene: Preloader (Frame 2)
=====================================
gotoAndPlay(1);
=====================================

Now we have 1 Scene with 2 frames. That will cause a loop. So everytime it hits Frame 1 it will calculate the percentage and Fill it up in the Preloader Bar: bar.gotoAndStop(int(loadpercent));

As you see it goes there and stops...


I wrote it better on my blog so you could see what is going around.. Most likly your serveoloop is messed up.

http://www.m0interactive.com/archives/2006/06/20/flash_preloa/

2006-06-20 09:46:34 · answer #1 · answered by ? 6 · 2 0

also if you have got sounds etc in your flash as i did, if you have the sounds exported in your first frame, your preloader will not kick in untill all the sounds have loaded.

i made a game with game music, but as all the music was about 500kb.

the first frame loads, this will include the music, untill the full 500kb has been loaded then flash player then will run frame 1 i which is loaded, then it will run your preloader, but as your file size is like 600kb, it will either kick it at the amount u have loaded.

drop me an e-mail and ill send u an example of what i mean

this will also happen with movie clips

you can implement the preloader code as above, which works there is an alternative

this code is on the process bar you have made on frame one

onClipEvent (enterFrame) {
//move the bar along by percentage
this._xscale = _root.getBytesLoaded()/_root.getBytesTotal()*100;
// work out percentage done
var per = Math.floor(_root.getBytesLoaded()/_root.getBytesTotal()*100);
//how many kb is downloaded
var kbdone = Math.floor(_root.getBytesLoaded()/1024);
//file size in kb
var totalkb = Math.floor(_root.getBytesTotal()/1024);

if (kbdone == totalkb) {
_root.gotoAndPlay("intro");
}
}

2006-06-22 12:26:12 · answer #2 · answered by Anonymous · 0 0

i think the reason you only see it at 90% is because it's not taking any time to load on your comp. on comps that are slower and don't have the file already it will show from the beginning. upload site and try on another comp or ask someone you know to preview it on their comp for you.

-nevermind, i just tried the link, no loading screen however the site came up really fast so maybe you don't need a loading screen. obviously the compression is good enough to come right up for me.

2006-06-20 16:08:22 · answer #3 · answered by Anonymous · 0 0

ugh u look brainy hon ,,, u need no Blondie as me here

2006-06-20 16:10:22 · answer #4 · answered by yyaliceyy 3 · 0 2

fedest.com, questions and answers