dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Preloader that's stage width

  1. #1
    Senior Member
    Join Date
    May 2003
    Posts
    160

    Preloader that's stage width

    hello all,

    i'm trying to create a preloader bar that is the stage's width. can someone point me in the right direction

  2. #2
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    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)..


  3. #3
    Senior Member
    Join Date
    May 2003
    Posts
    160
    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!

  4. #4
    Registered User greenham's Avatar
    Join Date
    Mar 2005
    Location
    Australia
    Posts
    555
    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);
    			}
    	}

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center