A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: LoadMovie (SWF) into an MC, then how to get rid of it?

  1. #1
    Junior Member
    Join Date
    Jun 2003
    Posts
    27

    LoadMovie (SWF) into an MC, then how to get rid of it?

    OK Gurus...

    My Flash™ is approaching 29 MB, and my SWF is 4 MB so right now I'll just have to give code examples...

    I'm not a programmer, but I fould some ActionScipting that would help load external SWFs.

    This is the code that I got from Flashkit... I think it creates an empty MC, then loads the external SWF into it. With the exception of this annoying "Output" screen that I don't want, it works.

    ********BEGIN CODE*********

    function preload(url, n)
    {
    this.createEmptyMovieClip("controller_mc", 1);
    loadMovieNum(url, n);
    controller_mc.onEnterFrame = function()
    {
    if(mc == undefined)
    {
    var mc = eval("_level" + n);
    }
    var bl = mc.getBytesLoaded();
    var bt = mc.getBytesTotal();

    if (bt > 0) { // if the movie has started loading
    var percentage = Math.round(bl / bt * 100);
    trace(percentage);
    if (bl >= bt) {
    // the movie has finished loading
    // position it
    mc._x = 400;
    mc._y = 200;
    delete this.onEnterFrame;
    // delete the method
    }
    }
    };
    }
    preload("swfs/250x250_nissan_sttsvll.swf", 2);


    ********END CODE*********

    However, Now I have a button (separate instance) that I want to clear this Movie or MC... can someone help with this?

    Thanks in advance... someone of the work you folks do out there is simply amazing.

    C

  2. #2
    Senior Member
    Join Date
    Jun 2003
    Location
    Kent, WA
    Posts
    536
    unloadMovieNum

    BTW, that code doesn't load the SWF into a movieclip, it loads it into a new level. (There's a difference.) If you were loading it into a movieclip, you could have just used removeMovieClip().

  3. #3
    Junior Member
    Join Date
    Jun 2003
    Posts
    27
    Thanks MarshdaBeachy

    But I'm looking for a direct answer to the code.. I'm not a programmer by any stretch... not to say I don't appreciate your reponse! It's just that looking at code doesn't give me a clue as to what I'm needing.

    Is there a working example out there of (simple - for stupid folks like me) code that does this:

    1. loads an external SWF
    2. allows you to place this external SWF anywhere on the work space
    3. and a button that will allow you to remove said external file.

    I have about 44 external SWF files that I want to load into a main SWF.

    Thanks folks.

  4. #4
    Senior Member
    Join Date
    Jun 2003
    Location
    Kent, WA
    Posts
    536
    Ok, did you want to be able to load multiple movies at once, or did you want the newest loaded movie to overwrite the old movie?

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