# Clear interval in external swf

**URL:** <https://forum.kirupa.com/t/clear-interval-in-external-swf/230736>\
**Category:** flash\
**Created:** [June 28, 2007, 4:29pm UTC](https://forum.kirupa.com/t/clear-interval-in-external-swf/230736 "2007-06-28T16:29:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![michey](https://avatars.discourse-cdn.com/v4/letter/m/3d9bf3/32.png) [@michey](https://forum.kirupa.com/u/michey)\
**Post date:** [June 28, 2007, 4:29pm UTC](https://forum.kirupa.com/t/clear-interval-in-external-swf/230736/1 "2007-06-28T16:29:21Z")

</div>

Hi

I have [\>\>this “QUOTER” swf\<\<](http://http://ceram-mic.com/.flas/TEST_1/ZITATE.html) which is loaded in main-swf.

“QUOTER”

```php
this._lockroot = true;
#include "mc_tween2.as"
stop();
var tl = _root;
var i = 0;
var anz = 8;
// Number of MCs  
var MCpauses = new Array(6, 4, 7, 7, 9, 12, 12, 4);
//Pauses - indidual for every MC
tl.createEmptyMovieClip("loader", 1);
tl.loader._x = 360;
tl.loader._y = 200;
nextPic();
function nextPic() {
 i = i<anz ? ++i : 1;
 var mc = tl.loader;
 mc._alpha = mc._xscale=mc._yscale=mc.phase=0;
 mc.attachMovie("MC"+i, "MC"+i, 1);
 mc.id = i;
 mc.onEnterFrame = function() {
  if ((this.phase += 3)>100) {
   this.phase = 100;
  }
  this._alpha = this._xscale=this._yscale=this.phase;
  if (this.phase == 100) {
   tl.iv = setInterval(fadeout, MCpauses[(this.id)-1]*1000);
   delete this.onEnterFrame;
  }
 };
}
function fadeout() {
 clearInterval(tl.iv);
 tl.loader.onEnterFrame = function() {
  if ((this.phase -= 5)<0) {
   this.phase = 0;
  }
  this._alpha = this._xscale=this._yscale=this.phase;
  if (this.phase == 0) {
   nextPic();
  }
 };
}
//Buttons Play-Stop  
play_btn._visible = false;
pause_btn._visible = true;
pause_btn.onRollOver = function() {
 attachMovie("TOOLTIP_S", "TOOLTIP_S", 10);
 TOOLTIP_S._x = _xmouse;
 TOOLTIP_S._y = _ymouse;
 TOOLTIP_S.startDrag(true);
 TOOLTIP_S.alphaTo(0, 6, "linear");
};
pause_btn.onRollOut = function() {
 TOOLTIP_S.removeMovieClip();
};
pause_btn.onRelease = function() {
 play_btn._visible = true;
 pause_btn._visible = false;
 clearInterval(tl.iv);
};
play_btn.onRollOver = function() {
 attachMovie("TOOLTIP_P", "TOOLTIP_P", 10);
 TOOLTIP_P._x = _xmouse;
 TOOLTIP_P._y = _ymouse;
 TOOLTIP_P.startDrag(true);
 TOOLTIP_P.alphaTo(0, 6, "linear");
};
play_btn.onRollOut = function() {
 TOOLTIP_P.removeMovieClip();
};
play_btn.onRelease = function() {
 stop();
 play_btn._visible = false;
 pause_btn._visible = true;
 nextPic();
};

```

Now I have to clear the interval of QUOTER before loading another swf in the main.  
The most logical thing to me , was to do it like this

```php
this["btn"+i].onRelease = function() {
  //trace(this);
  n = this.ID;
  for (j=1; j<=8; j++) {
   this._parent["btn"+j].enabled = false;
   this._parent["btn"+j].gotoAndStop("up");
  }
  //disable buttons
  var con:MovieClip = this._parent.createEmptyMovieClip("con"+this.ID, this._parent.getNextHighestDepth());
  con._x = 0;
  con._y = 0;
  con._alpha = 0;
  con.clearInterval(tl.iv);//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  con.loadMovie(swfArray[this.ID-1]);
  this.onEnterFrame = function() {
   this._parent.loadbar._visible = true;
   var percent:Number = int(Math.round(con.getBytesLoaded()/con.getBytesTotal()*100));
   this._parent.loadbar._xscale = percent;
   if (percent>=100) {
    //after swf is loaded, do the Tween
    delete this.onEnterFrame;
    loadbar._visible = false;
    trace("prev= "+prevCon);
    trace("con= "+con);
    this.gotoAndStop("press");
    fadeTrans(prevCon, con);
    prevCon = con;
.................................

```

Infortunately, this does not work.  
Can somebody tell me why and help find a solution?  
Would be nice.

Thanks a lot.
