Memory Usage goes insane! HELP!

Hi, I have a code where I controll a ball with my phones accelerometer. And I want the ball to stop when i hit a object, so I wrote this code:

import flash.events.Event;

var accelX:Number;

var fl_Accelerometer:Accelerometer = new Accelerometer();
fl_Accelerometer.addEventListener(AccelerometerEvent.UPDATE, fl_AccelerometerUpdateHandler);
function fl_AccelerometerUpdateHandler(event:AccelerometerEvent):void
{
    accelX = event.accelerationX;
}

ball.addEventListener(Event.ENTER_FRAME, moveBall);
function moveBall(evt:Event){
    ball.x -= accelX*30;
    
    if(ball.x > (640-ball.width/2)){
        ball.x = 640-ball.width/2;
    }
    if(ball.x < (0+ball.width/2)){
        ball.x = 0+ball.width/2;
    }
    if(ball.y > (960-ball.width/2)){
       ball.y = 960-ball.width/2;
    }
    if(ball.y < (0+ball.width/2)){
        ball.y = 0+ball.width/2;
    }
    
    ball.addEventListener(Event.ENTER_FRAME, moveBalle);
    function moveBalle(evt:Event)
    {
    if (ball.hitTestObject(Ground_1) || ball.hitTestObject(Ground_2) || ball.hitTestObject(Ground_3) || ball.hitTestObject(Ground_4))
    {

    if( accelX < 0){
    ball.x -= 1;
    }
    else if (accelX > 0) {
    ball.x += 1;
    }
    }
    }
}

The problem is that with this code, my memory usage just keep rising. I starts at 3000 and then keep going until how much I dont know, but after 10 min its above 10 000.

I have figure out that the problem is this:
function moveBalle(evt:Event)

Becuase if i remove this line the memory usage is fine, but then my ball doesnt stop at object.

Please help! :slight_smile:

**EDIT: **IT SEEMS LIKE IT IS THIS CODE:

    ball.addEventListener(Event.ENTER_FRAME, moveBalle);
    function moveBalle(evt:Event)

THAT DOESNT LIKE THIS CODE:

 
ball.addEventListener(Event.ENTER_FRAME, moveBall);
function moveBall(evt:Event){