How 'bout making a new layer and making a keyframe on the first frame and making the rest of the frames just plain ol' frames?
Then stick the code on the keyframe, DONT use stop(), and it should work fine.

Looks weird . I'll use my long code, it's easier to understand and read . thanks anyway
Yeah, functions are kinda hard to understand at first, but they simplify your life after you get the hang of it. I love them

I dunno if Ed Mack has any tutes on them, but seriously, give them a try.