Ayuda con ActionScript 3.0

Hola necesito ayuda, estoy programando un juego en ActionScript 3.0 y me da el siguiente error:

TypeError: Error #1009: No se puede acceder a una propiedad o a un método de una referencia a un objeto nulo.
   at Juegobueno_fla::MainTimeline/rebote()


El juego es un "Pong", es decir como un tenis horizontal y el error se muestra cuando la bola sale del escenario,es decir al cambiar de frame.

El codigo del juego es el siguiente:

var izquierda:Number = 0;
var derecha:Number = stage.stageWidth
var velocidadx:Number = 10
var velocidady:Number = 10
var puntuacion1:Number = 0
var puntuacion2:Number = 0


Bola.addEventListener(Event.ENTER_FRAME, rebote)

function rebote(e:Event):void{
   
   Bola.x += velocidadx;
   Bola.y += velocidady;
   
   if((Bola.hitTestObject(Barra1)) || (Bola.hitTestObject(Barra2)))
      
   {
      velocidadx *=-1;
   }
      
   if((Bola.hitTestObject(Limitearriba)) || (Bola.hitTestObject(Limiteabajo)))
   
   {
      velocidady *=-1;
   }
   if (Bola.x <= 0)
      {
      
      Bola.x = 259;                                 
      Bola.y = 184;
      puntuacion2 += 1;
      gotoAndPlay(2,"Juego1");
      stop();
      }
    if (Bola.x >= stage.stageWidth)
        {
       Bola.x = 259;                                 
        Bola.y = 184;
       puntuacion1 += 1
      gotoAndPlay(2,"Juego1");
      stop();
        }

}


stage.addEventListener(MouseEvent.MOUSE_MOVE, mover);

function mover(event:MouseEvent):void
{
       Barra1.y = mouseY
      Barra1.y = mouseY

}

stage.addEventListener(KeyboardEvent.KEY_DOWN, mover2);

function mover2(event:KeyboardEvent):void
{
       switch (event.keyCode)
      {
      case Keyboard.W:
      Barra2.y -= 20;
      break;
   
        case Keyboard.S:
      Barra2.y += 20;
      break;
}

}
stop();


Os dejo tambien una captura del juego para que os situeis:

http://imageshack.us/photo/my-images/829/juego.gif


Llevo varios dias investigando que puede pasar pero no encuentro la solucion.

Gracias
0 respuestas