/ Published in: ActionScript 3
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// Note the method of traversing the node <amount-list> using child("amount-list") // This encloses the dash in the amount-list name so that Flash can deal with it // Using (xmlData.gamedata.amount-list.amount.(@currency=="eur")) does not work // giving error: Access of undefined property list var xmlData:XML = <request info="1" game="ab"> <gamedata game="ab" timestamp="1320313349"> <amount-list> <amount currency="usd" step="1" pos="1">100</amount> <amount currency="eur" step="2" pos="2">200</amount> <amount currency="gbp" step="3" pos="3">300</amount> </amount-list> </gamedata> </request> var amt:int = (xmlData.gamedata.child("amount-list").amount.(@currency=="eur")); trace(amt); // 200