A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: [RESOLVED] CS4 preloader issue

  1. #1
    Senior Member
    Join Date
    Apr 2002
    Posts
    113

    resolved [RESOLVED] CS4 preloader issue

    I have this code on the first frame of the main timeline.

    PHP Code:
    //preloader
    loaderInfo.addEventListener(ProgressEvent.PROGRESSupdatePreloader);
    function 
    updatePreloader(evtObjProgressEvent):void {
        
    //container for the site download progress
        
    var percent:Number Math.floor((evtObj.bytesLoaded*100)/evtObj.bytesTotal);
        
    preloader_txt.text=percent+"%";
        if (
    percent>=100) {
    loaderInfo.removeEventListener(ProgressEvent.PROGRESSupdatePreloader);
            
    gotoAndPlay("letsStart");
        }

    When I test the code in flash CS4 I get no errors and the file opens correctly. When I load the file to a server, it loads but then goes to the 'letsStart' frame and won't advance from that frame. It's as if I said gotoAndStop. If I refresh the page I get 0% loaded and the file does nothing. What is wrong with my code? I appreciate any help. The letsStart frame is a blank frame with some soundfiles in a mc. I would expect it to just advance through the frame to the next frame like it does when played in the flash program.

  2. #2
    Senior Member
    Join Date
    Apr 2002
    Posts
    113
    Anyone have any advice? Thanks

  3. #3
    Senior Member
    Join Date
    May 2004
    Posts
    226
    The ProgressEvent.PROGRESS is unreliable, if the file is already cached it may not fire. You should add a separate listener for Event.COMPLETE.

  4. #4
    Senior Member
    Join Date
    Apr 2002
    Posts
    113
    Quote Originally Posted by v5000 View Post
    The ProgressEvent.PROGRESS is unreliable, if the file is already cached it may not fire. You should add a separate listener for Event.COMPLETE.
    Your advice was hugely helpful. I came up with this and now every issue is solved and everything is working great. THANKS!!

    PHP Code:
    //preloader
    loaderInfo.addEventListener(ProgressEvent.PROGRESSupdatePreloader);
    function 
    updatePreloader(evtObjProgressEvent):void {
        
    //container for the site download progress
        
    var percent:Number Math.floor((evtObj.bytesLoaded*100)/evtObj.bytesTotal);
        
    preloader_txt.text=percent+"%";
    }
    loaderInfo.addEventListener(Event.COMPLETEmoveOn);
    function 
    moveOn(e:Event):void {
            
    loaderInfo.removeEventListener(ProgressEvent.PROGRESSupdatePreloader);
            
    loaderInfo.removeEventListener(Event.COMPLETEmoveOn);
            
    gotoAndPlay("letsStart");
    }
    stop(); 

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