Well, you could figure out how many cycles is needed for the animation to complete, then make a "for" loop for the animation itself. Say it needs 30 iterations to finish, say;
for( int l = 0; l <30; ++l )
{
blah, blah, animation code, blah...
}
Since it's a sprite, it should be pretty easy to get how many iterations you need. The since you don't want it to terminate early, you'd have to put a boolean trigger in there...I saw you had the variable "flushing", so make it when flushing == 1, start the loop, then at the end of the loop, set it back to 0;
for( int l = 0; l <30; ++l )
{
blah, blah, animation code, blah...
if( l == 29 )
{
flushing = 0;
}
}
Keep in mind, if you keep the flushing animation in a second function, you'll have to pass the flushing variable in by reference so you can change it's value.
Hope that helps!
Bishop
Tux is my guildmaster.