# clearInterval inside function

**URL:** <https://forum.kirupa.com/t/clearinterval-inside-function/181231>\
**Category:** flash\
**Created:** [March 7, 2006, 4:47pm UTC](https://forum.kirupa.com/t/clearinterval-inside-function/181231 "2006-03-07T16:47:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pensamente](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/pensamente/32/1208_2.png) [@pensamente](https://forum.kirupa.com/u/pensamente)\
**Post date:** [March 7, 2006, 4:47pm UTC](https://forum.kirupa.com/t/clearinterval-inside-function/181231/1 "2006-03-07T16:47:42Z")

</div>

[AS]stop();  
import mx.transitions.Tween;  
import mx.transitions.easing.\*;  
//oq  
function Goq(num1) {  
clearInterval(myInterval1);  
var anim1:Tween = new Tween(oq, “\_y”, Back.easeOut, oq.\_y, num1, 2, true);  
var anim2:Tween = new Tween(oq, “\_alpha”, Back.easeOut, 0, 100, 2, true);  
}  
//oq  
function Gobrasao(num1) {  
clearInterval(myInterval2);  
var anim1:Tween = new Tween(obrasao, “\_y”, Back.easeOut, obrasao.\_y, num1, 2, true);  
var anim2:Tween = new Tween(obrasao, “\_alpha”, Back.easeOut, 0, 100, 2, true);  
}  
//onome  
function Gonome(num1) {  
clearInterval(myInterval3);  
var anim1:Tween = new Tween(onome, “\_y”, Back.easeOut, onome.\_y, num1, 2, true);  
var anim2:Tween = new Tween(onome, “\_alpha”, Back.easeOut, 0, 100, 2, true);  
}  
//  
// var myInterval = setInterval(functionName, interval, num1)  
var myInterval1 = setInterval(Goq, 8000, -100);  
var myInterval2 = setInterval(Gobrasao, 9000, 100);  
var myInterval3 = setInterval(Gonome, 10000, 180);[/AS]

have this code nd it’s working ok  
thing is when i put  
var myInterval2 = setInterval(Gobrasao, 9000, 100);  
inside first function like so…  
[AS]  
//oq  
function Goq(num1) {  
clearInterval(myInterval1);  
var anim1:Tween = new Tween(oq, “\_y”, Back.easeOut, oq.\_y, num1, 2, true);  
var anim2:Tween = new Tween(oq, “\_alpha”, Back.easeOut, 0, 100, 2, true);  
var myInterval2 = setInterval(Gobrasao, 1000, 100);  
}  
[/AS]

the clearInterval(myInterval2); won’t work no more…

any clues?!  
hope I explain myself clearly 🙂
