# How to stop an externally loaded swf clip?

**URL:** <https://forum.kirupa.com/t/how-to-stop-an-externally-loaded-swf-clip/180183>\
**Category:** Uncategorized\
**Created:** [February 26, 2006, 4:58pm UTC](https://forum.kirupa.com/t/how-to-stop-an-externally-loaded-swf-clip/180183 "2006-02-26T16:58:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![72monkeys](https://avatars.discourse-cdn.com/v4/letter/7/e36b37/32.png) [@72monkeys](https://forum.kirupa.com/u/72monkeys)\
**Post date:** [February 26, 2006, 4:58pm UTC](https://forum.kirupa.com/t/how-to-stop-an-externally-loaded-swf-clip/180183/1 "2006-02-26T16:58:00Z")

</div>

[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”);

};
