Problems with stop();

I have a loop that looks something like this:

if (_root._currentframes == _root._totalframes) {
      stop();
      trace("should have stopped!!");
} else { 
      do some other stuff;

}

when currentframes == totalframes, it calls the stop and trace function but not just once, infinatly. When currentframes == totalframes I want the whole program to stop!! Any idea’s??