Copy link to clipboard
Copied
Hi. I'm working on a game that has a bunch of data the client has given me in the form of a spreadsheet. My job is to put it into an array in an .AS file that another developer can load up at the beginning of the game without needing to parse lots of tables on startup.
I've built an importer to import and parse the tables in Flash App. The data is saved in a big ragged multidimensional array using a mix of arrays and objects. Now I need to save that array so my developer can load it easily.
I would be happy to just trace it out and copy/paste it into an .AS doc, but when I do that I get a lot of [object Object],[object Object].
Is there a built in function I am missing that would do this for me?
I'm looking for it to spit out something like this:
var myFormattedArray:Array = new Array( -->GoodnessGoesHere<-- );
Copy link to clipboard
Copied
no, just do that yourself:
function parseObjectF(obj:Object):void{
for(var s:String in obj){
if (obj is Array){
parseArrayF(Array(obj));
} else if(obj is String || obj is Number) {
trace(s,obj😞
} else {
parseObjectF(Object(obj));
}
}
}
function parseArrayF(a:Array):void{
for(var i:int=0;i<a.length;i++){
if (a is Array){
parseArrayF(Array(a));
} else if(a is String || a is Number) {
trace(i,a😞
} else {
parseObjectF(Object(a));
}
}
}
Find more inspiration, events, and resources on the new Adobe Community
Explore Now