2 Replies Latest reply on Sep 6, 2012 5:05 AM by Loic.Aigon

    Issue to convert a jsx Array to a AS3 Array

    Loic.Aigon Adobe Community Professional

      Hi all,


      I am calling a jsx code from within my extension to take advantage of the available xpath method in ExtendScript. I can then generate an array from the xpath result and send it back to the extension.



      function jsXpath ( xmlString , xpathExpression )
                var res = XML ( xmlString ).xpath ( xpathExpression ), i = 0, n = res.length(), arr = [];
                for ( i = 0 ; i < n ; i++ )
                          arr[ arr.length ]  = res[i];
                return arr; 


      My issue comes when I try to turn this jsx array into an AS3 array. EB then throws an error :


      var arr:Array  = jsxInterface.jsXpath ( model.programmes.toXMLString() , xPathExpression ) //as Array;

      Error #1034: Echec de la contrainte de type : conversion de flash.external::HostObject@2bfffe51 en Array impossible.

      if I trace the result without coercion, I can see the expected result. I just can't turn it into a regular AS3 array


      Any ideas ?


      TIA Loic