How to get Total Number of XML Nodes?


hello all,

 

i have flash program i'm doing in actionscript 3, using cs6.

 

i'm using xmlsocket class read-in xml data. write sample xml data being sent flash

program below...

 

i know line here (below) can access 4th "element or node" of xml data.

 

     accessing xml nodes/elements:

// *i created xml variable called xml, , "e.data" contains xml data
var xml:xml = xml(e.data);

 

// accessing 4th element of data:

xml.message[3].@var;          --->     "loggedoutusers"

xml.message[3].@text;         --->     "15"

 

 

     sample xml data:


     <frame>

0               <message var="screen2display" text="frame_1"/>

1               <message var="numusers" text="27"/>

2               <message var="loggedinusers" text="12"/>

3               <message var="loggedoutusers" text="15"/>

4               <message var="admins" text="2"/>

     </frame>

 

i'm new flash , actionscript i'm familiar other languages , how arrays work , such, , know for

example, in shell script total number of elements in array called "myarray" write like

this --> ${#myarray[@]}. , since processing xml data looks awful lot array figured there maybe

some way of accessing total number of "elements/nodes" in xml data...?

 

 

any thoughts appreciated!

 

 

thanks in advance,

matt

xml.childrens();

 

or

 

var xmllst:xmllist = xml.message

 

trace("length=",xmllst.length)

 

you can try.

thanks,

bala



More discussions in ActionScript 3


adobe

Comments

Popular posts from this blog

How to set the order of FAQs instead of alphabetical

Thread: Get UK Keyboard working

how do I change the e-mail address for my merchant account