# Disable a function

**URL:** <https://forum.kirupa.com/t/disable-a-function/317459>\
**Category:** Uncategorized\
**Created:** [December 21, 2010, 2:38pm UTC](https://forum.kirupa.com/t/disable-a-function/317459 "2010-12-21T14:38:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![KonstaraPrawiro](https://avatars.discourse-cdn.com/v4/letter/k/a5b964/32.png) [@KonstaraPrawiro](https://forum.kirupa.com/u/KonstaraPrawiro)\
**Post date:** [December 21, 2010, 2:38pm UTC](https://forum.kirupa.com/t/disable-a-function/317459/1 "2010-12-21T14:38:54Z")

</div>

Hi guys, I am currently have this script on frame 5, AS3:

\*var timer:Timer = new Timer (2000,45);  
timer.addEventListener(TimerEvent.TIMER, timerFunction);  
timer.start();

function timerFunction(event:TimerEvent):void  
{  
var mcClip:Cloud = new Cloud();  
mcClip.x = 400;  
mcClip.y = yVar;  
addChild(mcClip);  
var yVar:Number = (Math.ceil(Math.random()));

back\_btn.addEventListener(MouseEvent.CLICK, backMain)  
function backMain(Evt:Event):void  
{  
gotoAndPlay(1);

}\*

Everytime when I hit the BACK button which bring me to frame 1, the “timerFunction” still looping.

My question is, Is that a way to kill this script when I go back to frame 1?

Help will be much appreciated.  
Thanks.
