Hi all,
Im new with AS3 and had to do some editing of others code.
I have this code
private function editNumber():Boolean {
Console.log("editPlayer - #" + _cNumber.caption.text + ". ");
var result:Boolean;
var warning:String;
var existingPlayer:PlayerData;
if(_cName.caption.text == "")
warning = "a name";
if (existingPlayer.xml.name == _cName.caption.text)
warning = "a new name";
if (_cNumber.caption.text == "")
warning = !warning ? "a number" : warning + " and a number";
if (!warning) {
Console.log(" - has a name and number");
if (!numberFree()) {
Console.log(" - is being added with number");
updateData();
result = true;
}
} else {
alert("Your player needs "+warning+" to play.", "HOLD UP!");
}
return result;
}
After success compiling, it gave me a runtime error: [COLOR=Red]***Cannot access a property or method of a null object reference.
Fault, editNumber() ***[/COLOR]
which is this code:
if (existingPlayer.xml.name == _cName.caption.text)
Can anyone help me please?
Thanks