all groups > flash actionscript > june 2004 >
You're in the

flash actionscript

group:

partial load preloader


partial load preloader JFalk1
6/9/2004 10:00:35 PM
flash actionscript:
I am trying to create a preloader that will load half of the swf document, and
then play. I have tried everything I can think of and have only been able to
create a preloader that plays after the entire file is loaded. Can somebody
tell me how to do this?

Thanks a lot
Justin
Re: partial load preloader kglad
6/9/2004 10:11:44 PM
preloadI=setInterval(preloadF,100);
function preloadF(){
if(_root.getBytesLoaded()>=_root.getBytesTotal()/2){
clearInterval(preloadI);
// do something - at least 1/2 your movie is load
}
Re: partial load preloader JFalk1
6/10/2004 12:12:01 AM
I still can't get it to work. Here is the code I am using:

stop();
preloadI=setInterval(preLoadF,100);
function preLoadF(){
if(_root.getBytesLoaded()>=_root.getBytesTotal()/2){
_root.play();
clearInterval(preloadI);
};
_root.loader._xscale=(getBytesLoaded()/getBytesTotal())*100;
};

The last line is a loader bar (loader) I am using. When I preview the loader
bar stops at 50%, so apparently the clearInterval is working, but the timeline
doesn't advance until the file is 100% loaded. Am I doing something wrong?
Re: partial load preloader JFalk1
6/10/2004 12:19:46 AM
I got it to work, kind of. instead of having the function control the position
of the root timeline, I had it make an MC visible. that worked perfectly. Why
would that work, but controlling the timeline (play(), or gotoAndStop()) not
work?
AddThis Social Bookmark Button