开发者

How to display node name in Action script 3 xml

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜