Say I have the follwoing XML:
<?xml version="1.0" encoding="utf-8"?>
<language id="en" description="English">
<start>Start</start>
<instructions>some instructions</instructions>
</language>
How can I adapt this code to switch between the language id values? at the moment I get the error: Error #1069: Property language not found on String and there is no default value.
private function xmlLoaded(e:Event):void {
switch (e.target.data.language.@id) {
case "en":
_en = new XML(e.target.data);
_en.ignoreWhitespace = true;
break;
case "de":
_de = new XML(e.target.data);
_de.ignoreWhitespace = true;
break;
}
}
You have to create the XML before you accessing it. Also
<language>is your root element, so you won’t find children with this name.