A Flash Developer Resource Site

Results 1 to 1 of 1

Thread: Component Preloader Scripting Help

  1. #1
    FK Robot Wrangler

    Join Date
    Aug 2000
    Posts
    536

    Component Preloader Scripting Help

    *EDIT* i figured it out. my brain was on autopilot. all fixed!

    i recently downloaded a FLA (http://odin.prohosting.com/~oldnew/f...ng/preload.zip). it has been EXTREMELY helpful in solving the problem of "hanging preloaders" due to components exported to the first frame of my movies.

    but i do have a problem. what i have is a "main movie" (let's call it MAIN). the button in this movie loads a "content movie" (let's call it CONTENT) into a movieclip (called BIN) located on the main timeline of MAIN. i have the button scripted to load the "preloader movie" (let's call it PRELOADER) that i downloaded from the URL above into this movieclip. so, the PRELOADER is loading inside BIN. the problem is that when PRELOADER is finished, CONTENT loads into level0 on the main, root timeline (MAIN), thus completely replacing MAIN and the button. i have tried editing the PRELOADER script to instead load my CONTENT into the movieclip located on the main timeline of MAIN, called BIN, but i am having no luck. i would also settle for loading CONTENT into a movieclip on the PRELOADER timeline, if that's easier.
    all i'm doing with my editing attempts is crashing Flash. do you guys have any insight for me? i could sure use the help.

    thanks!


    here is the actionscript that i'm trying to edit. it belongs to the first frame of PRELOADER:
    Code:
    /* First thing to do is set the stage size of 
       this movie at the same size as your 
       "to be loaded" movie, and re-position the display
       elements to your liking.
       Also set the same framerate as your movie.
       Then replace "sound.swf" in 2 of the lines below, 
       with the name of your movie.
       Last, make sure your present movie is cleared 
       of any preloader, and most importantly, that it
       starts off with a first blank keyframe.
    */
    
    // Hides displayed elements
    this.reelmc._visible = false;
    this.loadbar._visible = false;
    percent_display = "";
    //create a new movieclip to load
    //the external movie into
    this.createEmptyMovieClip("container",10);
    //load the external movie into the new movieclip
    container.loadMovie("news.swf");
    //check the download status of the external
    //movie once every frame
    this.onEnterFrame=function(){
        //trace the percentage of the movie that has loaded
        percent=(this.container.getBytesLoaded()/this.container.getBytesTotal())*100;
    
    	if(!isNan(percent)){
    //      trace(percent+"% loaded");
    		if (percent == 0) {
    			percent_display = "";
    		} else {
    			percent_display = Math.ceil(percent) + "%";
    		}
    		this.loadbar._visible = true;
    		this.loadbar._xscale = percent;
    		if (percent > 1) {
    			this.reelmc._visible = true;
    		}
    		container.stop();
    	} else {
    //      trace("0% loaded");
          }
        if(percent == 100){
            delete this.onEnterFrame;
    		this.reelmc._visible = false;
    		percent_display = "";
    		this.loadbar._visible = false;
        	loadMovieNum("news.swf",0);
    		}
    }
    stop();
    Last edited by jaredigital; 07-31-2003 at 10:40 PM.

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