[FONT=Times New Roman][SIZE=3]Basically what I am doing is employing a reusable preloader. You have a screen, several buttons on it, you click a button and a swf clip is externally loaded onto the screen. The problem is the clip is looped and once loaded doesn’t stop, unless you load another movie. So I have writen some script to prevent that and show the clip only once. I have underlined that part of the script. However, for some reason inclusion of this part of the script prevent a swf clip to get loaded in the first place… Any ideas? If you need any other info please tell me. Thanks!!![/SIZE][/FONT]
[FONT=Arial][SIZE=2][/SIZE][/FONT]
The Script
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");
};
[U]preload.onLoadInit = function(targetMC) {
targetMC.onEnterFrame = function() {
if (this._currentframe == this._totalframes) {
this.stop();
delete this.onEnterFrame;[/U]
}
};
};
//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”);
};