# AS3 to AS2 loop problem

**URL:** <https://forum.kirupa.com/t/as3-to-as2-loop-problem/295878>\
**Category:** flash\
**Created:** [September 6, 2009, 4:13pm UTC](https://forum.kirupa.com/t/as3-to-as2-loop-problem/295878 "2009-09-06T16:13:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lotor2](https://avatars.discourse-cdn.com/v4/letter/l/c77e96/32.png) [@lotor2](https://forum.kirupa.com/u/lotor2)\
**Post date:** [September 6, 2009, 4:13pm UTC](https://forum.kirupa.com/t/as3-to-as2-loop-problem/295878/1 "2009-09-06T16:13:45Z")

</div>

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:

```auto
//# 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();
    }
}

```
