Hi,

Have a look for "e4x" if you are using AS3, if not look for http://www.xfactorstudio.com/

These will help immensely, but something like myXML.book.title might return an XMLList...

   Glen

ACE Flash wrote:
I was using this script, is there any short way to push them into an array?

Thank you.

var myXML:XML =
        <order>
                <book>

                        <title>Dictionary 1</title>
                </book>
                <book>
                        <title>Dictionary 2</title>

                </book>
        </order>;
        
var arr:Array = new Array();
var childLength:uint = myXML.children().length();


for ( var k:uint = 0 ; k < childLength ; k++ )
{
        arr.push( myXML.children()[k].title.toString() );

        trace( myXML.children()[k].title.toString() )
}




On Thu, Mar 19, 2009 at 1:11 PM, ACE Flash <[email protected]> wrote:

Hey there,

I was trying to parse the XML to get all value of <title> and store them
into array at once. Do I have to use loop to push them into an Array or
there is a shortcut for doing this?

I'd like to get something like this...

var arr:Array = new Array();

// to trace arr
arr[0] = Dictionary 1
arr[1] = Dictionary 2

Thank you



   1.
   var myXML:XML =

   2.
        <order>
   3.
                <book>
   4.
                        <title>Dictionary 1</title>
   5.
                </book>
   6.
                <book>
   7.
                        <title>Dictionary 2</title>
   8.
                </book>
   9.
        </order>;
   10.
   trace( myXML.book.title.toString() )




_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to