Arrays interpreted as string values

i’m importing data into a custom flash component, but the values i’m passing as arrays are being interpretted as strings, not arrays.

the data i’m using comes originally from an xml document. all of the info is stored in one array and, once loaded into the flash movie, i parse the array values and assign them to the variables i wish.

on my main stage, i have a data object holds all of my variables and values that get passed into the component.

mychartData={

arrXPixelRange:bar_array[0],

}

as i mentioned, the variables are assigned values from the original xml document – which were passed in the array called bar_array.

the above value should be equivalent to

arrXPixelRange:[0,189]

however, once inside the component, the value of “[0,189]” appears to function as a string, not an array. the strange is that, when i was hard coding the values (instead of using data from the xml document), it worked great. now that there is the extra step of importing the data from the xml doc and parsing out an array, it doesn’t work.

anyone ever have this problem? please let me know if you have ideas.

you explanation is a little choppy, but from what I can tell, it just looks like you arent converting the xml data to an array properly in bar_array. It seems bar_array is an array of strings and not an array of arrays. The problem might be where and how bar_array is created.

thanks to all who replied to this problem (both on this thread an another).

i was

  1. taking data such as the following from an xml doc:

<item name=“arrXPixelRange” arrXPixelRange="[0,189]" />

  1. importing it into an array in an actionscript file:

temp_array[0]=rootNode.childNodes[0].attributes[“arrXPixelRange”];

etc. until
line_array = temp_array;

  1. then in the main stage in my flash file, i was attaching my component and passing the line_array:

this.attachMovie(“FLineChartSymbol”,“chart”,_global.z++,line_array);

  1. and, finally, in the component, i was parsing up the line_array and assigning it to values. it was here that i discovered that the arrays (like “[0,189]”) were not being passed as arrays but strings.

where the real problem came in was when i was trying to pass multi-dimensional arrays, like

[ ][a,b],[c,d],[e,f]], [[a,b],[c,d],[e,f]] ,[[a,b],[c,d],[e,f]]]

what i ended up doing was changing the way the data was formatted in the xml document. the example above became

<item name=“arrXPixelRange” arrXPixelRange=“0,189” />

and then, in the flash component code, i used the split function to create an array with the delimiter being the comma.

for the multi-dimensional array, i used different dilimiters to split the various arrays and to create my overall 3 dimensional array.

make sense? :slight_smile: sorry if this is confusing.

it’s possible that there is a different and/or better way to do this… but it’s working. :slight_smile:

right, thats the solution needed. XML info is as a string, not as Flash objects, so [0,189] is a stiong not an array