# Loading external SWF files on button click

**URL:** <https://forum.kirupa.com/t/loading-external-swf-files-on-button-click/267041>\
**Category:** flash\
**Created:** [July 28, 2008, 12:54am UTC](https://forum.kirupa.com/t/loading-external-swf-files-on-button-click/267041 "2008-07-28T00:54:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![agon](https://avatars.discourse-cdn.com/v4/letter/a/eb8c5e/32.png) [@agon](https://forum.kirupa.com/u/agon)\
**Post date:** [July 28, 2008, 12:54am UTC](https://forum.kirupa.com/t/loading-external-swf-files-on-button-click/267041/1 "2008-07-28T00:54:20Z")

</div>

I am kind of new to AS and I want to load and external SWF file when I click a button and give a progress of the download.

I followed a tutorial in order to get this done.

Everything works great except it’s loading the movie immediatly instead of when you click the button.

As its loading I can click the button and it starts reloading. So I believe it is working.

I don’t want it start loading until you click the button.

Can someone tell me how to rearrange the code in order to do that.

Here is the code:

* * *

var mcl:MovieClipLoader = new MovieClipLoader();  
var mclL:Object = new Object();  
mclL.onLoadProgress = function(target,loaded,total) {  
loader.percent.text = Math.round((loaded/total) \* 100) + “%”;  
}  
mclL.onLoadInit = function() {  
loader.\_visible = false;  
loader.percent.text = “”;  
}  
mcl.addListener(mclL);  
mcl.loadClip(“benelli2.swf”,holder);  
b1.onRelease = function() {  
loader.\_visible = true;  
mcl.loadClip(“benelli2.swf”,holder);  
}
