use stl-style iterator for frame advance loop.