开发者

How to display node name in Action script 3 xml

开发者 https://www.devze.com 2023-01-01 21:02 出处:网络
My xml is like below <rat> <to>tt</to> <from>ggg</from> <heading>hhhhh</headin开发者_StackOverflow社区g>

My xml is like below

<rat>
    <to>tt</to>
    <from>ggg</from>
    <heading>hhhhh</headin开发者_StackOverflow社区g>
    <body>jjj</body>
</rat>

My AS3 code is

var example:XML = new XML(event.target.data);
_label.text = example[0].rat[0][nodeName];
addChild(_label);

I want to display the data like

to  = tt
from = ggg

how can i do that


var example:XML = <rat>
    <to>tt</to>
    <from>ggg</from>
    <heading>hhhhh</heading>
    <body>jjj</body>
</rat>;

for each (var node:XML in example.*)
{
    trace(node.localName(), "=", node);
}


you want: xml.branch.node.name();

see XML in Flash CS3/AS3

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号