You need to watch how much time has passed and only advance frames accordingly. Something like this:
void Animation::Update(int ms)
{
// this function would be called every update (every "frame")
// ms is the number of milliseconds passed since the last
// frame
time_remaining -= ms; // subtract the time passed from the
// time remaining in the frame
// then keep advancing frames until time remaining is above zero
while(time_remaining < 0)
{
AdvanceToNextFrame();
time_remaining += ms_per_frame;
}
}