#2025: The supplied DisplayObject must be a child of the caller.
That’s the error I get because of this code:
removeChild(units*);
So I traced out the parent of units*
trace(this.name);
trace(displayObjectPath(units*.parent));
removeChild(units*);
//With the function below
public static function displayObjectPath( avDisplayObject : DisplayObject ):String
{
var lvPath:String = "";
do
{
if (avDisplayObject.name) lvPath = avDisplayObject.name + ( lvPath == "" ? "" : "." + lvPath );
}
while (avDisplayObject = avDisplayObject.parent);
return lvPath;
}
Then the output is this:
pathing0.15914584510028362
root1.base.pathing0.15914584510028362
pathing0.15914584510028362
TypeError: Error #1009: Cannot access a property or method of a null object reference.
It’s like AS3 changes it’s mind after I try to see it’s parent.
Any ideas on why it’s not working?
I’m running removeChild() from: “pathing0.15914584510028362.”