|
-
Preloader help
I'm making an animation and I needed a preloader, so I took a newgrounds preloader template and did some heavy modifying to it. So instead of just a static movieclip for a loading bar, I've got an animated movieclip for a loading bar. I want it so that when, say, the movie is at 50%, the movieclip will be at frame 50, 75% at frame 75 and so on. But I'm very new to action script, and I'm having trouble editing the code. The movieclip just loops until the movie is fully loaded.
Here's the code I'm using:
PHP Code:
_root.stop();
stop();
var AUTO_PLAY = false;
var loadingComplete = false;
timerHandler();
function timerHandler()
{
if(!loadingComplete)
{
var loaded = _root.getBytesLoaded() / _root.getBytesTotal();
bar.gotoAndStop(loaded * 100);
if(loaded == 1)
{
loadingComplete = true;
if(AUTO_PLAY)
startMovie();
else
gotoAndStop("loaded");
return;
}
}
}
function startMovie()
{
_root.play();
}
Suggestions, anyone?
-
Total Universe Mod
Try:
Actionscript Code:
bar.gotoAndStop(Math.round(loaded * 100));
-
Yes! It works! Thank you so much!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|