Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Trying to convert CSV to Array

New Here ,
Mar 02, 2013 Mar 02, 2013

Trying to convert CSV to Array, but keep getting Error 2032 on my URLLoader.

Here is my code:

var loadedData:Array = [];
var myLoader = new URLLoader();
myLoader.addEventListener(Event.COMPLETE, onload);
var filePath:String;
var fileString:File;

function onload(Event):void
{
loadedData = myLoader.data.split(/\r\n|\n|\r/);
loadedData.pop();
for (var i:int=0; i<loadedData.length; i++)
{
var rowArray:Array = loadedData.split(",");
loadedData = {ID: rowArray[0], First: rowArray[1], Last: rowArray[2], Job: rowArray[3]
};
}
loadedData.shift();
}

fileToDownload = "generalsettingsNames.csv";
downloadFile();
var fileString:File = File.applicationStorageDirectory.resolvePath(fileToDownload);
filePath = (fileString.nativePath);
trace("filePath: "+filePath);

var myRequest:URLRequest = new URLRequest(filePath);
trace("MyRequest: "+myRequest.data);
myLoader.load(myRequest);
trace("MyLoader: "+myLoader.data);
var generalsettingsNames:Array = loadedData;
trace("GeneralSettingsNames:"+generalsettingsNames);

Here is the error:

Error #2032: Stream Error. URL: app:/Users/ernielail/Library/Application%20Support/com.maranathatech.digitalquikquotepro/Local%20Store/generalsettingsNames.csv

    at Function/backupSettings/$construct/loadBackup()[/Users/ernielail/Documents/apps work/Digital Quote App/code/3.1 iOS/backupSettings.as:697]

Any help would be greatly appreciated!

TOPICS
ActionScript
1.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 02, 2013 Mar 02, 2013

that error indicates an incorrect path/file name.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Mar 02, 2013 Mar 02, 2013

Is the file actually located at app:/Users/ernielail/Library/Application Support/com.maranathatech. digitalquickquotepro/Local Store/generalSettingsNames.csv?  Note that in my experience app:/ is right next to the AIR file.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 02, 2013 Mar 02, 2013

I'm not sure why app:// is being added. It's supposed to be looking in my applicationstoragedirectory

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 02, 2013 Mar 02, 2013

to start debugging your path/file problem, you need to know what code is triggering that error.

so, is anything being loading in downloadFile()?

do you see your trace output?  if yes, what is it?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 02, 2013 Mar 02, 2013

It's the URL request Amy mentioned. But I don't know how to fix it

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 02, 2013 Mar 02, 2013

again, is anything being loading in downloadFile()?

copy and paste here the trace output.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 02, 2013 Mar 02, 2013

Load Backup

filePath: /Users/ernielail/Library/Application Support/com.maranathatech.digitalquikquotepro/Local Store/generalsettingsNames.csv

MyRequest: null

MyLoader: undefined

GeneralSettingsNames:

Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL: app:/Users/ernielail/Library/Application%20Support/com.maranathatech.digitalquikquotepro/Local%20Store/generalsettingsNames.csv

    at Function/backupSettings/$construct/loadBackup()[/Users/ernielail/Documents/apps work/Digital Quote App/code/3.1 iOS/backupSettings.as:697]

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 02, 2013 Mar 02, 2013

attach a screenshot showing what's in /Users/ernielail/Library/Application Support/com.maranathatech.digitalquikquotepro/Local Store

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 02, 2013 Mar 02, 2013

Okay. Thanks for your help.Screen Shot 2013-03-02 at 7.54.18 PM.png

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 02, 2013 Mar 02, 2013
LATEST

attach a wider screenshot of the above showing the full path to generalsettingsNames.csv

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines