You don't say where you put it in the update method. The suggested code used it like this to stop the animation ofter the last frame was displayed if in "play once" mode...
if (currentFrame > totalFrames - 1) {
currentFrame = 0;
if(playMode == PlayOnce){
stopped = true;
}
}