A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Preloader help

  1. #1
    Junior Member
    Join Date
    Jan 2011
    Posts
    5

    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?

  2. #2
    Total Universe Mod jAQUAN's Avatar
    Join Date
    Jul 2000
    Location
    Honolulu
    Posts
    2,429
    Try:
    Actionscript Code:
    bar.gotoAndStop(Math.round(loaded * 100));

  3. #3
    Junior Member
    Join Date
    Jan 2011
    Posts
    5
    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center