multidimensional global arrays in Jitter Javascript

    Sep 19 2006 | 4:21 am
    I'm trying to figure out how to create a multidimensional array of global variables in Javascript (with Jitter installed). I thought I had a variation of the following code working at one point, but something's very wrong now. The idea is the top-level array tracks generations of multilayer visual compositions, while the nested array tracks the individual layers and their attributes:
    var layer = 1; var gen = 0; //
    g = new Global("params"); g.gen = new Array(); for (gen = 0; gen < 10; gen++) { // number of generations g.xdim[gen] = new Array(); g.ydim[gen] = new Array(); }
    When this is set up right, I should be able to read and write values such as:
    gen = 7; layer = 3; g.xdim[gen][layer] = 42;
    // using above vars, this would set g.xdim[7][3] = 42;
    BTW, in a perfect world, I wouldn't have to dimension the number of generations in advance.
    Any insight greatly appreciated!