Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
that error indicates an incorrect path/file name.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
I'm not sure why app:// is being added. It's supposed to be looking in my applicationstoragedirectory
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
It's the URL request Amy mentioned. But I don't know how to fix it
Copy link to clipboard
Copied
again, is anything being loading in downloadFile()?
copy and paste here the trace output.
Copy link to clipboard
Copied
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]
Copy link to clipboard
Copied
attach a screenshot showing what's in /Users/ernielail/Library/Application Support/com.maranathatech.digitalquikquotepro/Local Store
Copy link to clipboard
Copied
Okay. Thanks for your help.
Copy link to clipboard
Copied
attach a wider screenshot of the above showing the full path to generalsettingsNames.csv
Find more inspiration, events, and resources on the new Adobe Community
Explore Now