A Flash Developer Resource Site

Results 1 to 12 of 12

Thread: Loading External Movie...

Hybrid View

  1. #1
    Senior Member
    Join Date
    Aug 2000
    Posts
    343

    Loading External Movie...

    hi
    I have a "main" SWF that weighs 70kb and depending on where you click in that SWF, you load a bunch of external movies... so "button A" loads movieA, "button B" loads movieB and so on... My external movies (like movieA and movieB) also weigh around 70kb, yet there is always a little pause of around a second before the "main" movie shows it...

    I don't think that 70kb should load that slowly so maybe my load script is off? Here's what I have.

    In the main movie I have a loader with:
    Code:
    loader.loadMovie("movieA.swf");
    Any thoughts?
    Losse

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Posts
    343
    oh... on the same topic... Can I pre-load those external movies before they're called up?
    Losse

  3. #3
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    you can preload anything..but you need a place to 'put' them...

    so you can load them in the background..or whenever..and keep them invisible/hidden until you need them.

    I also suggest using a movieClipLoader() instance instead of loadMove().. and it ultimately gives you more controls..

  4. #4
    Senior Member
    Join Date
    Aug 2000
    Posts
    343
    I also suggest using a movieClipLoader() instance instead of loadMove().. and it ultimately gives you more controls..
    Never used movieClipLoader... how would I set that up in my scenario?

    And what do you mean by loading them in the background? Can you explain a bit?
    Losse

  5. #5
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    re: movieClipLoader(), there is a link in my footer that explains how to use it

    Can I pre-load those external movies before they're called up?
    yes you can load them normally (in the background is a term used meaning to load hem while other things are going, and not on demand when a button is clicked)

    so you load them normally.. in their placeholders/containers.. and then 'show' them when you want to.

  6. #6
    Senior Member
    Join Date
    Aug 2000
    Posts
    343
    Thanks... But if they're external movies... how would I load them without them being called upon?
    Losse

  7. #7
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    huh?

    you have to call/load them.. you cant just load something into 'thin air/space'.. you have to load it SOMEWHERE.. like where you normally would load/place it..but you would keep it invisible (_visible/_alpha) until you wanted to see it.

  8. #8
    Senior Member
    Join Date
    Aug 2000
    Posts
    343
    so use the moviecliploader... make sure they load at alpha 0% and when they're called upon switch to alpha 100%? That's neat...
    Losse

  9. #9
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    I would use _visible = false;

    if you have something _alpha = 0; you just cant see it..but its still interactive (ie: a button would still be clickable)

  10. #10
    Senior Member
    Join Date
    Aug 2000
    Posts
    343
    ah! I'll look up that variable... never used it... I would take it then "on click" it would switch to _visible = true?
    Losse

  11. #11
    Senior Member
    Join Date
    Aug 2000
    Posts
    343
    By the way... these movie clips can still be external? Like loading movie1.swf, movie2.swf?
    Losse

  12. #12
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    yes sir..

    you still need to load them into a target or container..

    Code:
    //create an object to handle the data available form the MovieClipLoader() object.
    var contentListener:Object = new Object();
    // create function that fires/executes when the content is complete
    contentListener.onLoadProgress = function(target_mc:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void {
        trace(target_mc._name + ".onLoadProgress with " + bytesLoaded + " bytes of " + bytesTotal);
    }
    // create function that fires/executes when the content is complete
    contentListener.onLoadComplete = function(target_mc:MovieClip, httpStatus:Number):Void  {
        trace(">> contentListener.onLoadComplete()");
    };
    // create function that fires/executes when the content has initialized and is ready for manipulation
    contentListener.onLoadInit = function(target_mc:MovieClip):Void  {
        trace(">> contentListener.onLoadInit()");
    	target_mc._visible = false;
    };
    
    // create our MovieClipLoader instance (called: contentLoader)
    var contentLoader:MovieClipLoader = new MovieClipLoader();
    // add our 'listener' object to our MovieClipLoader instance
    contentLoader.addListener(contentListener);
    contentLoader.loadClip("external.swf", containerClip); 
    
    someButton.onPress = function(){
    	containerClip._vivible = true;
    }
    you can use the other call back function

    onLoadStart()
    onLoadProgress()

    etc..etc

    to also do other things in your movie.. like display the percentage loaded. or start/stop another movieClip...etc

    this is AS2 by the way...

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