No shortcut if you want them as an Array.

Something like the following is pretty short, though, and does the job:

var arr:Array=[];

for each(var book:XML in myXML.book)
   arr.push([email protected]());

should do it. (Untested!).

Ian

On Thu, Mar 19, 2009 at 5: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