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

flash actionscript

group:

HELP! pre-loading .swf files


HELP! pre-loading .swf files hullo1234
4/1/2004 11:33:49 PM
flash actionscript:
Hi I'm a newbie flash user. I'm making a flash which eventually loads another
..swf file. The problem is that there is a delay for the user which has to
download the 2nd .swf when its called to be loaded. Sometimes the 2nd movie
doesn't even play because the loading time is too long. I was wondering if
there was a way to pre-load this movie, so that it is ready to play right when
it is called to be loaded. THANKS!
Re: HELP! pre-loading .swf files hullo1234
4/2/2004 5:44:03 AM
Re: HELP! pre-loading .swf files waynebw
4/2/2004 6:38:14 AM
Hey, a preloader I have, which works properly (unlike some) as it calculates
the total size of your .swf, not just the root scene.

You need 3 frames on the root scene.

[Frame 1]
Has a layer with your loading graphics. This must include a dynamic text field
with the var name percText.

[Frame 2]
Has a continuing frame of the above loading graphics (hit F5 to make it)
Also has this code on frame 2 only:

stop(); // REAL Loader code (actually works)
myTotal = _root.getBytesTotal() / 1024;
myReceived = _root.getBytesLoaded() / 1024;
myPerc = (myReceived/myTotal) * 100;
percText = int(myPerc) add "%";
loadbar.loadprogbar.gotoAndStop(Math.round(myPerc));

if (myPerc >= 100) {
play();
} else {
gotoAndPlay(1);
}


[Frame 3]
Contains a 'stop();' on a keyframe and also all the content to be displayed
upon loading.



Sorry if this doesnt make sense, but hope it helps!
Please ask and I can clarify anything

Cheers

AddThis Social Bookmark Button