?
Solved

How do I change xml to array

Posted on 2010-01-04
2
Medium Priority
?
139 Views
Last Modified: 2012-05-08
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

0
Comment
Question by:petersego
2 Comments
 
LVL 6

Accepted Solution

by:
magedroshdy earned 2000 total points
ID: 26170546
try the following
var imgArray:Array = xmlQuestions[0].childNodes[0].attributes.qPix.split(",");

Open in new window

0
 

Author Closing Comment

by:petersego
ID: 31672305
Thanks, works perfect...
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.
Suggested Courses
Course of the Month14 days, 12 hours left to enroll

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question