ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/removeChild()
at CharacterCreate/chooseClass()
at CharacterCreate()
at Document()
Document Class:
package {
import flash.display.MovieClip;
import flash.display.Stage;
public class Document extends MovieClip {
public function Document()
{
var cc:CharacterCreate = new CharacterCreate(stage);
stage.addChild(cc);
}
}
}
package {
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.net.SharedObject;
import flash.display.Stage;
public class CharacterCreate extends MovieClip {
private var shared:SharedObject = SharedObject.getLocal("stats");
private var stageRef:Stage;
public function CharacterCreate(stageRef:Stage) {
this.stageRef = stageRef;
if (shared.data.classes != undefined) {
chooseClass();
}
}
public function chooseClass() {
shared.data.xp = 0;
stageRef.removeChild(this);
var engine:Engine = new Engine();
stageRef.addChild(engine);
}
}
}