gotoAndPlay gets stuck inside functions

Hi all,

I am going crazy!!! I cannpt figure out why whenever I put a gotoAndPlay action inside of a function it doesn’t PLAY, it just goes to the frame I tell it and then STOPS there, even though there is no stop action there, and if I use just a regular button to access it it plays fine. Here is an example of my code that isn’t working:

_root.onEnterFrame = function() {
startTime = getTimer();
start_txt.text = startTime;
this.onEnterFrame = function() {
currentTime = getTimer();
current_txt.text = currentTime;
elapsedTime = (currentTime-startTime)/1000;
if (elapsedTime > 5){

it just goes to the monitor_transition movie clip and stops on the second frame for no good reason! why why why why why!!!