# Reusable Preloader

**URL:** <https://forum.kirupa.com/t/reusable-preloader/223389>\
**Category:** Uncategorized\
**Created:** [April 22, 2007, 3:07am UTC](https://forum.kirupa.com/t/reusable-preloader/223389 "2007-04-22T03:07:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![altereg0](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@altereg0](https://forum.kirupa.com/u/altereg0)\
**Post date:** [April 22, 2007, 3:07am UTC](https://forum.kirupa.com/t/reusable-preloader/223389/1 "2007-04-22T03:07:58Z")

</div>

Hello. I used the resuable preloader in one of my projects lately. The code used is as follows:

[LEFT]bar.\_visible = false;  
this.createEmptyMovieClip(“container”, “100”);  
my\_mc = new MovieClipLoader();  
preload = new Object();  
my\_mc.addListener(preload);  
preload.onLoadStart = function(targetMC) {

trace("started loading "+targetMC);  
container.\_visible = false;  
bar.\_visible = true;  
border.\_visible = true;  
pText.\_visible = true;

};  
preload.onLoadProgress = function(targetMC, lBytes, tBytes) {

bar.\_width = (lBytes/tBytes)\*100;  
pText.text = "% "+Math.round((lBytes/tBytes)\*100);

};  
preload.onLoadComplete = function(targetMC) {

container.\_visible = true;  
bar.\_visible = false;  
pText.\_visible = false;  
trace(targetMC+" finished");

};  
//default image  
my\_mc.loadClip(“news.swf”, “container”);  
//buttons  
button1.onPress = function() {

my\_mc.loadClip(“news.swf”, “container”);

};  
button2.onPress = function() {

my\_mc.loadClip(“kills.swf”, “container”);

};  
button3.onPress = function() {

my\_mc.loadClip(“picture3.jpg”, “container”);

};  
[/LEFT]

so I am preloading .swf instead of simple pictures, which is fine. Although… I have the menu included in the SWF’s that I load so I dont know to edit the events on the code above to match those objects. (The code above is included in main.swf: the file that includes the preloader, and navigation menus are on news or killls.swf) Please help me out :wasted:
