AS3 to AS2 loop problem

Hello,
I’m having difficulty changing this from AS3 to AS2 on this banner animation. It supposed to play the animation movie clip “main” 3 times and then stop.

Is there a simple way that I can change this?

Thanks

Old AS3 code:

//# of times to play animation
var loops:Number = 2;

//playback control
var loopCount:Number = 0;
main.addEventListener(Event.ENTER_FRAME, controlLooping);
function controlLooping(event:Event):void {
    if(event.target.currentFrame==event.target.totalFrames) {
        loopCount++;
        if (loopCount<loops) event.target.gotoAndPlay(1);
            else event.target.stop();
    }
}