2

I am tyring to learn flex programming myself. Below code gives me a warning

variable 'item' has no type declaration.

var xml:XML = xml as XML;

for each (var item in xml.employee) {
    Alert.show(item.@name); 
}

What is the type of variable item? I thought it was XMLNode, but it give me error. I want to remove the compile warning.

1 Answers1

1

Use this please, you haven't initialized item.


var xml:XML = new XML();

for each (var item:XML in xml.employee) {
    Alert.show(item.@name); 
}
smhx
  • 2,246
  • 18
  • 22