Disable a function

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.