Syntax for a multi-dimensional array?

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
herbie
Posts: 13
Joined: March 16th, 2010, 5:37 pm

I know the syntax for a 1 dimensional array..
var myArray = new Array();

But what is the syntax for a 2 or 3 dimensional array?


Also.. what is the syntax for making a number into a string?
say for example,

alert(myArray[0] (as String)); ...or something like that...
User avatar
lloydalvarez
Enhancement master
Posts: 460
Joined: June 17th, 2004, 9:27 am
Location: New York City, NY
Contact:

But what is the syntax for a 2 or 3 dimensional array?
If you mean an array that holds arrays you could define it like this:

Code: Select all

var myArray = [new Array(),new Array()];
Although in most cases you don't need to do that you can just define the array directly with the values:

Code: Select all

var myArray = [[0,0],[1,1]];
Also.. what is the syntax for making a number into a string

Code: Select all

var myNum = 100;
var myStr = myNum.toString();
AE scripting is based on javascript so you can google these questions using the javascript keyword and you'll find that there's tons and tons of resources out there.

-Lloyd
Post Reply