Return to Snippet

Revision: 52867
at November 3, 2011 20:53 by weavermedia


Initial Code
// 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

Initial URL


Initial Description


Initial Title
AS3 Dealing with dashes in XML node names

Initial Tags


Initial Language
ActionScript 3