# Stopping a ENTER\_FRAME function

**URL:** <https://forum.kirupa.com/t/stopping-a-enter-frame-function/254169>\
**Category:** flash\
**Created:** [March 9, 2008, 12:56am UTC](https://forum.kirupa.com/t/stopping-a-enter-frame-function/254169 "2008-03-09T00:56:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![alpharaven](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@alpharaven](https://forum.kirupa.com/u/alpharaven)\
**Post date:** [March 9, 2008, 12:56am UTC](https://forum.kirupa.com/t/stopping-a-enter-frame-function/254169/1 "2008-03-09T00:56:55Z")

</div>

How can I make a on ENTER\_FRAME function from constantly running?

Here is what I have

```auto

addEventListener(Event.ENTER_FRAME, onEnterFrame);
private function onEnterFrame(event:Event):void
        {
            var speed:Number = 6;
            var ysize:Number = Tall - this.height;
            var xsize:Number = Wide - this.width;

            this.height += ysize / speed;
            this.width += xsize / speed;

            if (Math.abs (ysize) < 0.3 && Math.abs (xsize) < 0.3) {
                this.height = Math.abs (ysize);
                this.width = Math.abs (xsize);
                trace("done");
                
            }
        }

```

I know if I used the same thing in AS2 all I needed to do is delete this.onEnterFrame.

Are there pre-defined classes in AS3 that would do the same thing.
