Skip to main content
Inspiring
March 4, 2007
Question

preloader script

  • March 4, 2007
  • 2 replies
  • 348 views
I am new to scripting, so this is probably a pretty easy fix. I have the
following code for my preloader:

onClipEvent (load) {
total = _parent.getBytesTotal();
}

onClipEvent (enterFrame) {
loaded = _parent.getBytesLoaded();
percent = int(loaded/total*100);
perc1 = ""+percent+"%";
gotoAndStop(percent);
if (loaded == total) {
_parent.gotoAndPlay(2);
}
}

As of now, the clip loads fine in another swf, but I want the clip to start
playing before is has fully been loaded so that it cuts down on the time the
viewer has to wait, say at 75% loaded, or 65% for example. How would I change
the above code?

Also, how would I change it to reflect in the percentage as well, for example,
if it starts playing when it is really 65% loaded, how would the code change to
show that it is fully loaded, in the percentage and the full loading bar, even
though it really isn't...

Does that make sense? Thanks for the help.

This topic has been closed for replies.

2 replies

kglad
Community Expert
Community Expert
March 4, 2007
you're welcome.
kglad
Community Expert
Community Expert
March 4, 2007
:

Participant
March 4, 2007
Perfect, thanks!