Skip to main content
Inspiring
December 4, 2011
Question

how to read xml nodes in as3.....

  • December 4, 2011
  • 3 replies
  • 2038 views

Hi  i m able to read xml node's attribute but i required to save whole node value to my movieclip object here my xml

<xml>

    <node thumb='images/t1.jpg' bigswf='images/t1.swf' catagoery='t1 link' link='tl.xml'/>

    <node thumb='images/t2.jpg' bigswf='images/t2.swf' catagoery='t2 link' link='t2.xml'/>

    <node thumb='images/t3.jpg' bigswf='images/t3.swf' catagoery='t3 link' link='t3.xml'/>

</xml>

when i trace xml.node[0].@thumb then i got output>>images/t1.jpg

how can i get value of full node like this >>> <node thumb='images/t1.jpg' bigswf='images/t1.swf' catagoery='t1 link' link='tl.xml'/>

I m trying xml.node[0] but it shows nothing...

This topic has been closed for replies.

3 replies

Inspiring
December 4, 2011

yes

list[0].@thumb

Inspiring
December 4, 2011

var xml:XML = <xml>

    <node thumb='images/t1.jpg' bigswf='images/t1.swf' catagoery='t1 link' link='tl.xml'/>

    <node thumb='images/t2.jpg' bigswf='images/t2.swf' catagoery='t2 link' link='t2.xml'/>

    <node thumb='images/t3.jpg' bigswf='images/t3.swf' catagoery='t3 link' link='t3.xml'/>

</xml>

var list:XMLList = xml.node;

trace(list[0].toXMLString());

Inspiring
December 4, 2011

by this way xml data will be change to string.. can i use this as xml data

var list:XMLList = xml.node;

var xmlnode:string=list[0].toXMLString() <<<< can i extract thumb attribute value from this node value?. because now it goes to a string value..

;

Inspiring
December 4, 2011

your xml data can be made into an xmlList, each node could be an item in the list

xmlList[0]

Inspiring
December 4, 2011

I tried this, but it dosent work

var xm:XMLList=XMLList(xml.node[0)

trace(xm)<<<this shows nothing