A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [F8] preloading external movie swfs into main.swf mc

  1. #1
    Senior Member layerburn's Avatar
    Join Date
    Jul 2006
    Location
    USA
    Posts
    542

    [F8] preloading external movie swfs into main.swf mc

    Ok I had tacked this onto one of my other posts in another forum and didn't really get a working solution so i'm going to try and post new in this forum now.

    I have a main swf, mvid.swf and promo.swf. mvid.swf and promo.swf each have a movie embedded into them, I want to load these into two empty movieclips in main.swf, target1 and target2. I was using

    on (release) {target1.loadMovie("mvid.swf)}

    on my buttons to load the movies up into the empty movie clips.

    Now my question is, how can i have everything preload all at once so that when it is time for the movies to play they will start right up, also having the main.swf not play until everything has preloaded?

    I was following this tutorial but couldn't get it to work properly.

    http://www.bokelberg.de/actionscript/4.html

    It seemed to work, however when I would direct my timeline to where the loaded movie should play, it wouldn't play. mvid.swf plays shortly after the main.swf starts up, but promo.swf should be on frame20. They are both promotional videos that the user needs to be able to view at any time so I have two buttons that will take them to either frame 19 where mvid is or frame 20 where promo is. Perhaps this is where my problem is? Can I have it so that they are preloaded and then play only when i want?

    So I am very confused and very lost. I hope I explained everything clearly. I would post of my working fla, but my due to my client I'm unable to do that as the content is classified. If anyone could point me in the right direction I would be forever greatful. This is running me around in circles and I need to get this figured out soon. I appreciate your time and patience.
    This is your brain. This is your brain on script.

  2. #2
    Senior Member
    Join Date
    Apr 2006
    Posts
    1,059
    look at the movieclip Loader and just loop through all the SWF's on the first frame of the main

    make them all invisible and do a gotoAndStop(1) to stop them on the first frame

    then make them visible and do a play() when you want them to show and play

    I said to use the MovieClipLoader because you can track the movies load progress and loadfinish

  3. #3
    Senior Member layerburn's Avatar
    Join Date
    Jul 2006
    Location
    USA
    Posts
    542
    ok i took a look at the movieclip Loader and it's looks like it should work, but I couldn't get it to work for me. I'm still learning when it comes to actionscript. Here is my preloader i have on my main.swf first frame

    Code:
    stop( );   
     var nPreloaderInterval:Number = setInterval(this, "checkPreloader", 100);   
       
     function checkPreloader( ):Void {   
       var nLoadedBytes:Number = this.getBytesLoaded( );   
       var nTotalBytes:Number = this.getBytesTotal( );   
       tProgress.text = Math.round(nLoadedBytes / nTotalBytes * 100) + "% downloaded";
       if(nLoadedBytes >= nTotalBytes) {   
         clearInterval(nPreloaderInterval);   
       play( );   
       }   
     }
    so exactly how would i include the movieclip Loader to this existing code? And is there a way to tell it to wait until everything including the two external swfs are done loading before allowing the main.swf to proceed?
    Again I apologize for the slowness, but i'm following where you were going, just not sure how to combine the two I guess. Thanks for your time and patience.

    Cheers
    This is your brain. This is your brain on script.

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