1 Reply Latest reply on May 16, 2012 11:07 PM by kglad

    XML string to Array?

    raylaur Level 1

      I want this XML code to become an array in AS2  (code is a snipet of large code)

       

      <ViewTitles><![CDATA[Front View,  Back View, Left View, Right View, Internal View]]></ViewTitles>

       

      The XML loads correctly.  The following code yields the expected string:

       

      var vTitles=UInode.childNodes[1].childNodes[0];

      trace(vTitles)

       

      Flash Output: Front View,  Back View, Left View, Right View, Internal View

       

      I then use the following to turn it ino an array:

       

      viewTitles=vTitles.split(", ");

      trace(viewTitles[0])

       

      Flash Output: undefined

       

      It seems vTitles=UInode.childNodes[1].childNodes[0] is not recognized as a string. 

      I've tried vTitles.toString();  before using split() but no luck.

       

      What is the best way to convert a string from XML to an array.  Am I not using the correct syntax?