[COLOR=#003366]I have writen the script for a reusable preloader. basically you click on one of the buttons and an swf clip is loaded onto the screen. However, there are two problems I need to solve:[/COLOR]
[COLOR=#003366]1. the clips continues playing over and over again. I dont need them to loop. Probably I should include “stop();” somewhere so that they would stop after the first time but can’t figure out how exactly to do that.[/COLOR]
[COLOR=#003366]2. imagine that you are on the main page then you click a button and are forwarded to the place where you see clips. after you are dont you click back to go to the main page again and that is what happens except the fact the clip remain loaded on the screen. how to remove it? I guess I should write “false” for “container”, but once again i dont have a clear idea how to solve this.[/COLOR]
[COLOR=#003366][/COLOR]
[COLOR=#003366]HERE IS THE SCRIPT:[/COLOR]
[COLOR=#003366][/COLOR]
[COLOR=#003366]MovieClip.prototype.fadeIn = function() {
this.onEnterFrame = function() {
if (this._alpha<100) {
this._alpha += 10;
} else {
delete this.onEnterFrame;
}
};
};
clip_preloader._visible = false;
loading_text02._visible = false;
var empty = this.createEmptyMovieClip(“container”, “100”);
empty._x = 240;
empty._y = 263;
my_mc = new MovieClipLoader();
preload = new Object();
my_mc.addListener(preload);
preload.onLoadStart = function(targetMC) {
trace(“started loading “+targetMC);
container._alpha = 0;
clip_preloader._visible = true;
loading_text02._visible = true;
};
preload.onLoadProgress = function(targetMC, lBytes, tBytes) {
clip_preloader._width = (lBytes/tBytes)*100;
};
preload.onLoadComplete = function(targetMC) {
container.fadeIn();
loading_text02._visible = false;
clip_preloader._visible = false;
trace(targetMC+” finished”);
};
//default image
my_mc.loadClip(“default.jpg”, “container”);
//buttons
slot01.onPress = function() {
my_mc.loadClip(“clip01.swf”, “container”);
};
slot02.onPress = function() {
my_mc.loadClip(“clip02.swf”, “container”);
};
slot03.onPress = function() {
my_mc.loadClip(“clip03.swf”, “container”);
};[/COLOR][URL=“http://www.kirupa.com/developer/actionscript/moviecliploader.htm”]