Looping thru 2 dim array

Posted on 2012-08-23
Last Modified: 2012-08-27
Hi experts:
I have an array in Actionscript 3.  

private var myArray:Array = [  [1.2,3.4],

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


Question by:snix123
    LVL 44

    Accepted Solution

    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.
    private var myPoint;
        for (var i:uint; i < myArray.length; i++) {
            myPoint = myArray[i];
            point = myPoint[0];
            point2 = myPoint[1];

    Open in new window


    Author Closing Comment

    Thank you...

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Purpose To explain how to place a textual stamp on a PDF document.  This is commonly referred to as an annotation, or possibly a watermark, but a watermark is generally different in that it is somewhat translucent.  Watermark’s may be text or graph…
    Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

    759 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

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now