Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

actionscript 2.0 XML to ARRAY?

Hello,

I would like to get data into array from XML file like below;

My XML file ;

<myxml>

15

25

30

56

</myxml>

And i want array in actionscript which contain numbers in xml

array = ['15','25',30','56'];

How can i do that with actionscript ?

1 Answer

Relevance
  • Anonymous
    10 years ago

    var myarrayxml_arr:Array = new Array();

    var xml:XML = <masternode>

    <node>1</node>

    <node>2</node>

    <node>3</node>

    <node>4</node>

    <node>5</node>

    </masternode>

    for(var i:uint = 0; i < xml.children().length(); i++){

    myarrayxml_arr.push('"'+xml.children()[i]+'"');

    }

    trace(myarrayxml_arr);//outputs "1","2","3","4","5"

    //to remove quotes: > myarrayxml_arr.push(xml.children()[i]);

    Source(s): personal
Still have questions? Get your answers by asking now.