hello all,
i'm trying to create a preloader bar that is the stage's width. can someone point me in the right direction :)
Printable View
hello all,
i'm trying to create a preloader bar that is the stage's width. can someone point me in the right direction :)
hi-
what code are you using so far?
you can use _xscale to scale your movieClip (preloader bar) across the stage..
(predefined, or using the Stage.width property)
or
have a tweened animnation that is 100 frames long to complete.. and use that.
Is the preloader code what you are having trouble with? (it would be the same no matter what type of preloader you do)..
:)
i've seen it done both of those ways, but not to fit the stage width. right now i'm open to whichever direction works best. basically i have a fullscreen flash window that i want the bar to load across from one side to the other.
thanks for your help!
I would recommend using the first option (using stage.width) rather than a tweened animation. It makes your file size slightly smaller and insures for smoother animation. Although, for something as small as a preloader I think you'd be battling to notice any differences.
Here's how I would do it:
Code:this.createEmptyMovieClip("pre",0);
i_pre = setInterval(f_pre,10,this.getBytesLoaded()/this.getBytesTotal()*Stage.width);
function f_pre(wid)
{
if(wid<=Stage.width)
{
with(pre)
{
moveTo(0,0);
beginFill(0xFF0000,100);
lineTo(wid,0);
lineTo(wid,20);
lineTo(0,20);
endFill();
}
}
else
{
clearInterval(i_pre);
}
}