• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 648
  • Last Modified:

Looping thru 2 dim array

Hi experts:
I have an array in Actionscript 3.  

private var myArray:Array = [  [1.2,3.4],
                                               [7.8,10.4],
                                               [12.2,1.0]];

I would like to be able to get the first element, the point 1.2, 3.4, in a loop.  When I try this I get a large error.  

I would like to do this:
    for (var i:uint; i < myArray.length; i++) {
        point = myArray[i,0];
        point2 = myArray[i,1];

etc.
   }

Thoughts?
0
snix123
Asked:
snix123
1 Solution
 
aikimarkCommented:
I'm not sure of the exact syntax, but I think you're going to have to use an intermediate array to get at the data in the manner your code snippet suggests.
Example:
private var myPoint;

    for (var i:uint; i < myArray.length; i++) {
        myPoint = myArray[i];
        point = myPoint[0];
        point2 = myPoint[1];

etc.
   }

Open in new window

0
 
snix123Author Commented:
Thank you...
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now