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

Export a complex multidimensional array to valid actionscript?

Contributor ,
Jul 29, 2017 Jul 29, 2017

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<-- );

TOPICS
ActionScript
286
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 ,
Jul 29, 2017 Jul 29, 2017
LATEST

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));

}

}

}

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