1 Reply Latest reply on Nov 16, 2017 9:12 AM by ClayUUID

    dynamic field to load csv

    gfxg29898003

      Hi everybody,

       

      I am using the following function to load data from a csv file,

       

      var myRequest:URLRequest = new URLRequest('aris.csv');

         var loadedData:Array = [];

         var myLoader = new URLLoader();

         myLoader.addEventListener(Event.COMPLETE, onload);

         myLoader.load(myRequest);

       

       

         function onload(Event):void

      {

       

       

       

       

         loadedData = myLoader.data.split(/\r\n|\n|\r/);

       

       

       

       

         for (var i:int=0; i<loadedData.length; i++){

         loadedData[i] = loadedData[i].split(";");

      }

       

      I made a dynamic field and I changed the above function to dynamically load any csv I need.

       

      var myRequest:URLRequest = new URLRequest(teama1.text + '.csv');

         //var myRequest:URLRequest = new URLRequest('aris.csv');

         var loadedData:Array = [];

         var myLoader = new URLLoader();

         myLoader.addEventListener(Event.COMPLETE, onload);

         myLoader.load(myRequest);

       

       

         function onload(Event):void

      {

       

       

       

       

         loadedData = myLoader.data.split(/\r\n|\n|\r/);

       

       

       

       

         for (var i:int=0; i<loadedData.length; i++){

         loadedData[i] = loadedData[i].split(";");

      }

       

      My problem is that when I test it in Animate it words fine, but when I try to use it in my Ui software it does not.

      Any suggestions?

       

      Thanks In advance

        • 1. Re: dynamic field to load csv
          ClayUUID Adobe Community Professional

          Your question is impossible to answer with the amount of detail that you've given. We have no idea what your "Ui software" is, and you've only revealed that it doesn't work fine, so we can't troubleshoot your problem.

           

          The only thing I can recommend is that you attempt to narrow down where, exactly, the code is failing. Is it finding the CSV file? Is the URL loader instantiating? Is the complete event firing? Is loadedData getting populated?

          1 person found this helpful