I have variables some of which have values derived from dynamic text boxes with instance names. Then some var = (calculations) and some "if" statments. Finally a final value is derived and passed to a movie. The problem is that my trace statments show that the values are calculated only once, not continuously. Does this need to be in a onEnterFrame function? I tried that but it didn't work, although I made have made a typo.

Here's the code. It's the section at the bottom starting with SunTime that doesn't work.

PHP Code:
stop(); 

var 
mrotate 0
var 
sunMinutes 0
var 
sunHours 0

//Move hands to analog minutes 
minutesB.onPress = function() { 
    var 
mth 0
    var 
mxmin 104
    var 
mymin 91.5
    
minutesB._x mxmin
    
minutesB._y mymin
    
minutesB.onEnterFrame = function() { 
        
mth Math.atan2(_ymouse-mymin_xmouse-mxmin); 
        
mrotate mth*180/Math.PI
        
minutesB._rotation mrotate
    }; 
}; 

//Sets digital minutes 
minutesB.onMouseUp = function() { 
    
delete minutesB.onEnterFrame

    if (
mrotate<0) { 
        
displayMinutes_txt.text Math.round((mrotate+360)/6); 

    } else { 
        
displayMinutes_txt.text Math.round(mrotate/6); 
    } 
     
//variable for movie timeline 
    
sunMinutes displayMinutes_txt.text

    if (
displayMinutes_txt.text<10) { 
        
displayMinutes_txt.text "0"+displayMinutes_txt.text
    } 
}; 

//Move hands to analog hours 
hoursB.onPress = function() { 
    var 
hth 0
    var 
hxmin 104
    var 
hymin 91.5
    
hoursB._x hxmin
    
hoursB._y hymin
    
hoursB.onEnterFrame = function() { 
        
hth Math.atan2(_ymouse-hymin_xmouse-hxmin); 
        
hrotate hth*180/Math.PI
        
hoursB._rotation hrotate
    }; 
}; 
//Sets digtal hours 
hoursB.onRelease = function() { 
    
delete hoursB.onEnterFrame

    if (
hrotate<0) { 
        
displayHours_txt.text Math.round((hrotate+360)/30); 
         
    } else { 
        
displayHours_txt.text Math.round(hrotate/30); 
    } 

//variable for movie timeline     
    
sunHours displayHours_txt.text

    if (
displayHours_txt.text<10) { 
        
displayHours_txt.text "0"+displayHours_txt.text
    } 
}; 


//Manual switching beteen AM and PM 
ampmmov.onRelease = function() { 

    if (
ampmthing == false) { 
        
displayAmPm_txt.text "pm"
        
ampmthing true
    } else { 
        
displayAmPm_txt.text "am"
        
ampmthing false
    } 

}; 

//Code that moves playhead to correct movie frame 

var sunTime 0
trace ("aa"+sunTime); 

sunTime = (sunMinutes+(sunHours*60)); 
trace ("a"+sunTime); 

    if (
ampmthing == true) { 
        
sunTime sunTime+720
        
trace ("b"+sunTime); 
    } 
     
    
sunTime sunTime-300
    
trace ("c"+sunTime); 
     
    if (
sunTime<0) { 
        
sunTime = (sunTime+1440); 
        
trace ("d"+sunTime); 
    }; 

trace ("e"+sunTime); 


_parent.sun.gotoAndStop(sunTime