How do I change xml to array

I have a xml-attribute, that has a line of commaseparated numbers that I want to use as an array.
But even thought I can trace that the content has entered my movie correctly, the numbers doesnt seem to work as an array.....
Take a look at this:
var imgArray:Array = Array(xmlQuestions[0].childNodes[0].attributes.qPix);
trace(imgArray) results correctly in this: 1,3,4,9
so I would think that I could simply enter the array-name like this
var maskNumbers:Array = [imgArray];
initMaskBlocks(maskNumbers);

but no, the result isnt entered into the function, that you can see in the code below. The code mask an image in 16 bites based on the entered array-numbers.

Even though the correct numbers is traced correctly inside the function
trace(maskArray) shows 1,3,4,9
only the upper left 16th part of the picture is shown.

it is as if the function doesnt accept it as an array even though the trace shows exactly the same if I manually enters the same numbers in the maskNumbers-array

Im lost here. please help....
function initMaskBlocks(maskArray:Array){
for (var i:Number = 0; i < maskArray.length; i++) {
   maskBlock(maskArray[i], qmaskW, qmaskH, qmaskW * ((maskArray[i] - 1) % 4), qmaskH * ((maskArray[i] - 1) / 4 >> 0));

}

Open in new window

petersegoAsked:
Who is Participating?
 
magedroshdyConnect With a Mentor Commented:
try the following
var imgArray:Array = xmlQuestions[0].childNodes[0].attributes.qPix.split(",");

Open in new window

0
 
petersegoAuthor Commented:
Thanks, works perfect...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.