David,
Flash handles arrays such as a[x][x] as arrays of arrays.
So what you'd be setting up is something that looks like this:
var a:Array=[ [1,2,3],[4,5,6]];
which you could create as above, or to adjust the code to look more like
yours:
var a:Array=new Array();
a[0]=new Array(); // This is the step that you were missing...
a[0][0]=1;
a[0][1]=2;
a[0][2]=3;
a[1]=new Array(); // You need to do this for each array contained
in the top-level array
a[1][0]=4;
a[1][1]=5;
a[1][2]=6;
Make sense?
HTH,
Ian
On 12/16/06, dc <[EMAIL PROTECTED]> wrote:
hi list -
i thought that flash supported 2d arrays of the [x][y] syntax persuasion.
can someone give me some pointers what I'm doing wrong?
maybe you cant create arrays this way, you can only access them?
function artest() {
var arr = new Array();
arr[1][1] = "whatsup";
arr[3] = "three";
trace("arr is:");
trace(arr);
trace(arr[1][1]); // undefined
trace(arr[3]); // three
}
arr is:
undefined,undefined,undefined,three
undefined
three
--
-------------------------------------------
David "DC" Collier
mailto:[EMAIL PROTECTED]
+81 (0)80 6521 9559
skype: callto://d3ntaku
-------------------------------------------
Pikkle 株式会社
http://www.pikkle.com
-------------------------------------------
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com