My task is to show multiple items from the XML in a single textfield
My XML looks like this:
<shoplist>
<shop>
<shopname>Superstore</shopname>
<city>Singapore</city>
<street>Singapore Street 55</street>
<zip>SI-45678 Singapore</zip>
<tel>Tel: +33 3333 3333</tel>
</shop>
<shop>
<shopname>Coolshop</shopname>
<city>Yemen</city>
<street>Yemen Street 33</street>
<zip>YE-43434 Yemen</zip>
<tel>Tel: +55 5555 5555</tel>
</shop>
<shoplist>
In my Flash AS3 file I have a dynamic textfield with the instance name: myTextblock
The code is the following:
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, onLoaded);
var xml:XML;
function onLoaded(e:Event):void
{
xml = new XML(e.target.data);
var itemlist:XMLList = xml.shop.shopname;
trace(itemlist[0]);
myTextblock.text = itemlist[0]
}
loader.load(new URLRequest("./wheretobuy.xml"));
This displays the Shopname within the textfield. So far so good. Now I want not only the shopname, but also the city, the street and the telephone number to show up in my textfield and I have no idea how. Tried alot of stuff, but my AS3 knowledge lacks alot.
What to do? Thx ahead.