Error # 1067: Implicitly enforcing String values ​​to an unrelated XML type - AS3

I am creating a small flash-based language translator. I cross-bind the children of the parent element of the XML node when the user types a word or phrase into the text box. The result will be a translation of the word or phrase returned in the output_txt text box.

The problem is that Flash is giving me this error regarding the type of the String value for the XML type of an unrelated type. What for? Any suggestions? Thank!

generate_mc.buttonMode=true;

var English:String;
var myXML:XML;
var myLoader:URLLoader = new URLLoader();

myLoader.load(new URLRequest("Language.xml"));
myLoader.addEventListener(Event.COMPLETE, processXML);

function processXML(e:Event):void {
 myXML=new XML(e.target.data);
}

var langObj:Object = new Object();
for (var entry:XML in myXML.children()) {  //getting error #1067 on the XML========
 langObj[entry.english.toString()]=entry.cockney.toString();
}

generate_mc.addEventListener(MouseEvent.CLICK, onClick);

function onClick(event:MouseEvent) {
 English=textfield_txt.text;

 if (langObj[textfield_txt.text]!=undefined) {
  output_txt.text = myXML.cockney; //this is where the translation will appear. is this correct syntax?===============
 } else {
  trace( "the key is not defined: " + textfield_txt.text);
 }
}
+3
source share
1 answer

for (... in myXML.children()) for (... in myXML.children()). for (... in ...) for each (... in ...), , . -, /: , .

+4

Source: https://habr.com/ru/post/1735946/


All Articles