# How to load an external movie using a link within an external swf - urgent

**URL:** https://forum.kirupa.com/t/how-to-load-an-external-movie-using-a-link-within-an-external-swf-urgent/224695
**Category:** Uncategorized
**Created:** [May 4, 2007, 2:30pm UTC](https://forum.kirupa.com/t/how-to-load-an-external-movie-using-a-link-within-an-external-swf-urgent/224695 "2007-05-04T14:30:08Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![spaghbol](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@spaghbol](https://forum.kirupa.com/u/spaghbol)
#### Post date: [May 4, 2007, 2:30pm UTC](https://forum.kirupa.com/t/how-to-load-an-external-movie-using-a-link-within-an-external-swf-urgent/224695/1 "2007-05-04T14:30:08Z")

</div>

Hi all

Flash CS3 but coding in AS2 - mac.

I have asked this question before but i was using loadMovie() - I am now using loadClip and the MovieClipLoader class and obviously I have managed to break something.

I have a number of external swfs which load fine, with preloaders using MovieClipLoader, into an empty MC on the stage called holder\_mc. In one of the external swf’s, there are two links to separate external swf’s - if you click on either of them, the current swf is unloaded and the new one is loaded. I used:

```auto
myButtonWithinSwf.onRelease = function() {
this._parent.loadMovie("newMovie.swf");
}

```

However now that I am using a different code (because before, evrything wasnt preloaded, i just had a white space until it appeared) the code within the swf obviously has to change. The only problem is, I cant for the life of me work out what it is, I have tried all sorts of combinations and probably missed the most obvious one. I do not want to create empty movie clips, I want the movie to load into the MC which I have defined - holder\_mc - and usually I would tell it to unloadClip() before loading the new one, but it cant load a new one if it has unloaded itself. I hope that makes sense!  
This is the code I am using on the main timeline to control the preloading of the external swf’s:

```auto
var mcLoader:MovieClipLoader = new MovieClipLoader();
var loadListener:Object = new Object();
loadListener.onLoadStart = function() {
    holder_mc.stop();    
};
loadListener.onLoadProgress = function(target:MovieClip, loadedBytes:Number, totalBytes:Number) {
    pleaseWait._visible = true;
    var preloaded:Number = Math.floor(loadedBytes / totalBytes * 100);
    preloaderMC._visible = true;
    preloaderMC.loadText.text = preloaded.toString() + "%";
    preloaderMC.loadBar._yscale = preloaded;
};
loadListener.onLoadInit = function() {
    preloaderMC._visible = false;
    pleaseWait._visible = false;
    holder_mc.play();
};

/ ****register listener object with MovieClipLoader object**** /
mcLoader.addListener(loadListener);

anotherButton.onRelease = function() {
mcLoader.unloadClip(holder_mc);
mcLoader.loadClip("anotherMovie.swf", holder_mc);
}

```

my preloader is called preloaderMC and pleaseWait is just a movie clip that is placed on the other side of the screen for another reason. loadText and loadBar are the dynamic text and loading bar within the preloaderMC.

I really hope someone can help me ASAP as this was all working before with loadMovie() and now suddenly I cant get it working!

Thanks in advance

Theo
