# Loading/Unloading - swfs inside of swfs

**URL:** <https://forum.kirupa.com/t/loading-unloading-swfs-inside-of-swfs/244082>\
**Category:** flash\
**Created:** [November 14, 2007, 5:33am UTC](https://forum.kirupa.com/t/loading-unloading-swfs-inside-of-swfs/244082 "2007-11-14T05:33:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![almaline03](https://avatars.discourse-cdn.com/v4/letter/a/41988e/32.png) [@almaline03](https://forum.kirupa.com/u/almaline03)\
**Post date:** [November 14, 2007, 5:33am UTC](https://forum.kirupa.com/t/loading-unloading-swfs-inside-of-swfs/244082/1 "2007-11-14T05:33:42Z")

</div>

Here we go…

* * *

I have a main.swf.

Main.swf contains 4 buttons(about, portfolio, contact, clients).

These for buttons call in external swfs(ex. portfolio.swf) into an empty movie clip on the main.swf stage.

inside portfolio.swf are three more buttons(print, web, logos)

## When you click on one of these buttons they need to call in another external swf(web.swf) and also remove itself(portfolio.swf)

That is where I run into my problem.

this is the code i am using for the original buttons on the main.swf:

```auto
function initMovieLoad(path) {
movieToBeLoaded = path;
if(!initializedExternalMovies) {
initializedExternalMovies = true;
loadNewMovie();
} else {
target.gotoAndPlay('midpoint'); 
}
}

_global.loadNewMovie = function() {
target.unloadMovie(); 
target.loadMovie(movieToBeLoaded); 
target._y=-130;
target._x= -160;
}

var mc:MovieClip = this.createEmptyMovieClip('target', this.getNextHighestDepth());

initMovieLoad('intro.swf');

this.homeBTN.onRelease = function() {
initMovieLoad('home.swf'); 
}

this.aboutBTN.onRelease = function() {
initMovieLoad('about.swf'); 
}

this.portfolioBTN.onRelease = function() {
initMovieLoad('portfolio.swf'); 
}

this.clientsBTN.onRelease = function() {
initMovieLoad('clients.swf'); 
}

this.contactBTN.onRelease = function() {
initMovieLoad('contact.swf'); 
}

```

I thought I could just place this code inside the portfolio.swf and boom, everything would be set. but it didnt work.

I need to know how to call from the main.swf that web button inside of the portfolio.swf to bring in the web.swf

Any ideas would help at this point. THX
