views:

80

answers:

0

Flash is throwing an error saying that my constructor has 0 arguments when in fact, I have one. Below is my code. Thanks in advance for your help.

package com.objects {

  import flash.display.Sprite;
 import flash.events.*;
 import flash.display.Stage;

 public class Ball extends Sprite {

  private var yDir = 1;
  private var xDir:Number = 1;
  private var cspeed = 3;
  private var sRef:Stage;
  private var paddle:Paddle;

  public function Ball(pad:Paddle = null):void
  {
   paddle = pad;
   addEventListener(Event.ENTER_FRAME, loop);
  }
       }
}


package com.objects {

import flash.display.Sprite;
import flash.events.*;
import flash.display.Stage;

public class Engine extends Sprite {
private var pad:Paddle;
private var sRef:Stage;
private var ball:Ball;
private var bricks:BrickMap;
private var brickHolder:Array;

     public function Engine(stageRef:Stage):void
     {
     brickHolder = new Array();
     sRef = stageRef;
     pad = new Paddle();
     pad.x = sRef.stageWidth/2;
     pad.y = 550;
     ball = new Ball(pad);
     addChild(pad);
     ball.x = 49;
     ball.y = 300;
     sRef.addChild(ball);

     bricks = new BrickMap();
     generateMap();
     addEventListener(Event.ENTER_FRAME, loop);
     sRef.addEventListener(MouseEvent.MOUSE_MOVE, mouseHandler);

    }
  }
}