Ok, I have raise these question a thousand times and so far no ones been able to help me. I am raising again because I discovered something new. In the past I haven't been able to create parameters for class objects, every time when I do so I get the following error
1136: Incorrect number of arguments. Expected 0.
I notice that my classes that are subclasses to Movie Clip or Sprite are able to have constructor parameters, but my classes that are sub class to a subclass aren't. is there any reason behind this?
var cloud = new Cloud(5, 4);
package com.objects{
import flash.events.Event;
import flash.utils.*;
public class Cloud extends gameObject {
public var maxSpeed = 30;
public var minSpeed = 5;
public var cspeed:Number = 0;
public function Cloud(min:Number = 0, max:Number = 0):void
{
var rand = Math.ceil(Math.random() * totalFrames);
gotoAndStop(rand);
}
public function rand(min:Number, max:Number):void
{
maxSpeed = max;
minSpeed = min;
cspeed = (Math.ceil(Math.random() * maxSpeed)+ minSpeed);
}
override public function updateObject():void
{
eApi.setChildIndex(this, (eApi.numChildren - 1));
y += cspeed;
if(y > 800)
garbage = true;
}
}
}
Here is the parent class
package com.objects {
import flash.display.MovieClip;
import flash.display.Stage;
import flash.events.*;
import flash.utils.getTimer;
public class gameObject extends MovieClip implements IgameObject
{
public static var EG:Engine;
public var wPosX:Number = 0;
public var wPosY:Number = 0;
public var vPosX:Number = 0;
public var vPosY:Number = 0;
public var px:Number = 0;
public var py:Number = 0;
public var right:Number = 0;
public var bottom:Number = 0;
public var left:Number = 0;
public var top:Number = 0;
public var centerx:Number = 0;
public var centery:Number = 0;
static public var eApi:EngineApi;
public var health:Number = 1;
public var maxHealth:Number = 1;
protected var lastTime:Number;
public var ts:TargetSystem;
public var col:Number;
public var row:Number;
public var map:Number;
public var dead:Boolean = false;
public var garbage:Boolean = false;
public function gameObject():void {
}//End Constructor
static public function addEngine(e:EngineApi):void
{
eApi = e;
}
public function updateObject():void
{
}
public function Attack(dir:Number = -40):void
{
}
public function GarbageCollect():gameObject
{
return this;
}
public function getTime():int
{
var time:int = getTimer();
return time;
}
}
}