Copy link to clipboard
Copied
Hey guys,
normally in javascript I can just create a multidimensional array like so:
myArray = [ [] ];
and then assign values like this:
myArray[0][0] = 'item1';
In extendscript I get the error "undefined is not an object". Is there something I forgot about, or is this just not possible in Indesign?
I found out it was another problem. The code works like this, but you need to define in the beginning how many arrays are in the array. Otherwise it will throw the "undefined" error.
points = new Array(object.paths.length);
for(i = 0 ; i<object.paths.length; i++){
points = new Array();
}
This code works now, as the length of the array is exactly the length you need. And for every key you add another array, to create your two dimensional array on every key.
Copy link to clipboard
Copied
Hi Stamm,
Try below code:
var myArray = [[,]];
myArray[0][0] = 'item1';
Copy link to clipboard
Copied
I found out it was another problem. The code works like this, but you need to define in the beginning how many arrays are in the array. Otherwise it will throw the "undefined" error.
points = new Array(object.paths.length);
for(i = 0 ; i<object.paths.length; i++){
points = new Array();
}
This code works now, as the length of the array is exactly the length you need. And for every key you add another array, to create your two dimensional array on every key.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more