# Timer not initiating

**URL:** <https://forum.kirupa.com/t/timer-not-initiating/222309>\
**Category:** flash\
**Created:** [April 12, 2007, 1:03pm UTC](https://forum.kirupa.com/t/timer-not-initiating/222309 "2007-04-12T13:03:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lovejeet](https://avatars.discourse-cdn.com/v4/letter/l/977dab/32.png) [@lovejeet](https://forum.kirupa.com/u/lovejeet)\
**Post date:** [April 12, 2007, 1:03pm UTC](https://forum.kirupa.com/t/timer-not-initiating/222309/1 "2007-04-12T13:03:21Z")

</div>

i have a code for photo gallery that has previous and next buttons.but i want to sync them with timer.but the problem is that my timer is not starting…please if anyone can help?

var gallery\_xml = new XML();  
gallery\_xml.ignoreWhite = true;  
gallery\_xml.onLoad = function(success) {  
if (success) {  
var gallery = this.firstChild;  
pathToPICS = gallery.attributes.picturePath;  
NUMOFPICS = gallery.childNodes.length;  
for (var i = 0; i\<NUMOFPICS; i++) {  
[//tempArray.push](https://tempArray.push)(gallery.childNodes\*.attributes.title);  
picArray.push(gallery.childNodes\*.attributes.source);  
}  
}  
////////////////////////////////////////////  
//loading first picture  
picHolder.loadPic(0);  
//thumbnail\_mc.loadPic(0);  
////////////////////////////////////////////  
function startTimer() {  
timerStartTime = getTimer();  
\_root.onEnterFrame = function() {  
timer = Math.floor((getTimer()-timerStartTime)/1000);  
if (timer\>2 && timer%2 == 0) {  
tottime = tottime+2;  
timer = “started”;  
//loadpic(0);  
showTimer = tottime;  
timerStartTime = 0;  
timer = 0;  
startTimer();  
}  
};  
}  
// Button Code  
prev.onRelease = function() {  
if (cur == 0) {  
picHolder.loadPic(picArray.length-1);  
//test1= “previous”;  
} else {  
picHolder.loadPic(cur-1);  
//test1= “previous”;  
}  
};  
next.onRelease = function() {  
if (cur == picArray.length-1) {  
picHolder.loadPic(0);  
//test1= “next”;  
//loadthumbs(i);  
} else {  
picHolder.loadPic(cur+1);  
//test1= “next”;  
}

```
};

```

};  
test=timer;  
// Load the xml file  
gallery\_xml.load(xmlFILE);  
startTimer();  
showTimer1 = tottime;

please tell me where am i going wrong?
