2 Replies Latest reply on Feb 27, 2014 8:15 AM by Bit Crusher

    ExternalInterface Call Javascript Array to AS2 throwing undefined error

    Bit Crusher Level 1

      I need to pass various (tracking) IDs to a .swf.  the IDs are in an array like this =

       

      <script type="text/javascript">

      function getImpID() {

      var medID={impID:'12345',pvID:'677890',exID:'654332'};

      return medID;

      };

      function thisMovie(banner) {

          if (navigator.appName.indexOf("Microsoft") != -1) {

              return window[banner]

          }

          else {

              return document[banner]

          }

      }

       

       

      window.onload=getImpID;

      </script>

       

      Right now the AS2 I have is:

       

       

      import flash.external.*;

      System.security.allowDomain(sourceDomain)

       

      var allID:String = ExternalInterface.call.apply("getImpID");

      function getIDs(){

                var impID:Number;

                var pvID:Number;

                var exID:Number;

                var id_arr:Array = allID.split(",");

          _root.id_test.text = impID;

      }

       

      getIDs();

       

      Basically what I need is to split the three ID's from the javascript so that I can append them with various URL clickTags in the AS.  Main issue I have is the 'undefined' error, so I'm going out on a limb here that the AS2 I have doesn't do anything right now of value.  Biggest head scratcher for me is, if I have the IDs in an array in the javascript (medID) how to get them not only properly into Flash but to separate them into their separate IDs. 

       

      Any suggestions would be greatly appreciated.

       

      Thanks!