Forums > Javascript

lists in javascript

Apr 17 2011 | 1:59 am


I am not too experienced with JS. I am stuck on using only certain elements from a list. I am trying to take an object’s location (x y width height) and keep it’s current x and y while changing the width and height. I looked at the examples for lists and strings and couldn’t figure this out. Any suggestions on where to look?


Apr 17 2011 | 8:01 pm

different ways you could approach this. the easiest would probably be using arrays. for example:

var myBox = new Array(4);

Now you have a myBox with 4 slots for information. Now you can put information into the array by accessing each slot like this: myBox[0], myBox[1], myBox[2] and myBox[3] (arrays are always indexed from 0!!).
To output the entire array out an outlet you simply do: outlet(0, myBox), for individual elements outlet(0, myBox[2]).
Hope this is helpful.

Apr 17 2011 | 11:31 pm

Great, I think this is exactly what I was after. Thanks!

Viewing 3 posts - 1 through 3 (of 3 total)

Forums > Javascript