I ask this question time and time again and havnt got an answer. Its driving me crazy evertytime I get it. Sometimes it works, and sometimes it doesnt. When I pass a object through the constructor, it gives me the error message. So I always got to make a second method to get it to work. Here is my code if anyone can please help me
var ds = new desertStorm(ship);
Above is the object i call and below is the class.
package com.objects{
import flash.display.MovieClip
public class desertStorm extends Stinger {
private var turret1:Torret;
private var swap:Boolean = false;
private var target:Avatar;
public function desertStorm(target:Object):void
{
this.target = target;
health = 2;
turret1 = new Torret();
eApi.addGameChild(turret1);
}
override public function updateObject():void
{
if(!swap)
{
eApi.swapGameChildren(this, turret1);
swap = true;
}
y += cspeed;
turret1.x = x;
turret1.y = (y + 40);
}
}
}
if anyone can help me out that would be great