# clearInterval not working

**URL:** <https://forum.kirupa.com/t/clearinterval-not-working/330704>\
**Category:** Uncategorized\
**Created:** [March 3, 2013, 6:45am UTC](https://forum.kirupa.com/t/clearinterval-not-working/330704 "2013-03-03T06:45:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arnab\_Dutta](https://avatars.discourse-cdn.com/v4/letter/a/eb8c5e/32.png) [@Arnab\_Dutta](https://forum.kirupa.com/u/Arnab_Dutta)\
**Post date:** [March 3, 2013, 6:45am UTC](https://forum.kirupa.com/t/clearinterval-not-working/330704/1 "2013-03-03T06:45:15Z")

</div>

I am making a gallery for my project. this gallery will have 10 sections of images. each section contains around 200 images. A main Interface will call each sections externally.

I have used the below code for transition and time delay for each section;  
[COLOR=#333333][COLOR=#333333]import mx.transitions._;[/COLOR][/COLOR]  
[COLOR=#333333][COLOR=#333333]import mx.transitions.easing._;[/COLOR][/COLOR]

[COLOR=#333333][COLOR=#333333]stop();[/COLOR][/COLOR]  
[COLOR=#333333][COLOR=#333333]function playpause() {[/COLOR][/COLOR]  
[COLOR=#333333][COLOR=#333333]isplaying ? clearInterval(myint): myint = setInterval(myFunction, 6000);[/COLOR][/COLOR]  
[COLOR=#333333][COLOR=#333333]isplaying = !isplaying; [/COLOR][/COLOR]  
[COLOR=#333333][COLOR=#333333]}[/COLOR][/COLOR]

[COLOR=#333333][COLOR=#333333]function myFunction()[/COLOR][/COLOR]  
[COLOR=#333333][COLOR=#333333]{[/COLOR][/COLOR]  
[COLOR=#333333][COLOR=#333333]if(mc\_content.\_currentframe==mc\_content.\_totalfram es){[/COLOR][/COLOR]  
[COLOR=#333333][COLOR=#333333]mc\_content.gotoAndStop(mc\_content.\_currentframe)[/COLOR][/COLOR]  
[COLOR=#333333][COLOR=#333333]}else{[/COLOR][/COLOR]  
[COLOR=#333333][COLOR=#333333]TransitionManager.start(mc\_content, {type:Fade, direction:Transition.IN, [/COLOR][/COLOR]  
[COLOR=#333333][COLOR=#333333]duration:2, easing:None.easeNone, numStrips:20, dimension:5});[/COLOR][/COLOR]  
[COLOR=#333333][COLOR=#333333]mc\_content.nextFrame();[/COLOR][/COLOR]  
[COLOR=#333333][COLOR=#333333]}[/COLOR][/COLOR]  
[COLOR=#333333][COLOR=#333333]}  
[/COLOR][/COLOR]  
Each section contains, play, pause, next and previous buttons.

Problem is that when I view one section from Interface, everything works fine, just for the first time. But when I view any other section, its starts playing automatically and time interval also becomes fast. Play/Pause buttons also don’t work then.  
Plz help me!!!
