A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: AS2 Array question

  1. #1
    Member
    Join Date
    Oct 2002
    Location
    England
    Posts
    80

    AS2 Array question

    I'm a little confused and need some help.

    I'm loading in some information from an xml file and trying to store the info into different arrays.

    var myArray:Array = new Array();

    function processContentsOfXML(contents_xml) {
    var sections= contents_xml.childNodes[0].childNodes[0].childNodes.length;
    var loadedVar1 blar blar...
    var loadedVar2 blar blar...
    for (var i = 0; i<sections; i++) {
    myArray[i] = new Array();
    myArray[i].push(loadedVar1,loadedVar2);
    }
    }

    All the information is loading in fine. The thing I'm confused at is why all the info is being pushed into just one array. I'm asking flash to set up a new array for each section that is in the xml. When I trace myArray0 or myArray1 I get undefined. When I trace myArray, all the info for the two sections are there.

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    i is seen as an item of myArray, when coded like you did. Try _level0["myArray"+i]

    gparis

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center