Subj : Array Object index question To : netscape.public.mozilla.jseng From : cburdon@tampabay.rr.com (Izman) Date : Wed Oct 22 2003 11:22 am Ok... given the following code and the assumptions that cx, globalObj and parentObj were defined in earlier code: JSObject* myArray = JS_NewArrayObject(cx, 2, NULL); JS_AddRoot(cx, myArray); JSObject* myObj1; JSObject* myObj2; rval myval1; rval myval2; myObj1 = JSMyObject::JSInit(cx, globalObj, NULL); myval1 = OBJECT_TO_JSVAL(myObj1); myObj2 = JSMyObject::JSInit(cx, globalObj, NULL); myval2 = OBJECT_TO_JSVAL(myObj2); JS_SetElement(cx, myArray, 0, &myval1); JS_SetElement(cx, myArray, 1, &myval2); JS_DefineProperty(cx, parentObj, "myarray", OBJECT_TO_JSVAL(myArray), NULL, NULL, JSPROP_ENUMERATE); What code allows me to determine which array value was used? Does the getProperty routine for parentObj indicate which index was used? If not how do I read which myarray index was accessed? Reason for the question: I want each of the array objects to be "bound" to a member of an array in the original program. The index of the myarray object directly correlates with the index of the program's array. This would eliminate the need for a variable in each object indicating the index it is associated with and also eliminate code associated with setting and reading that variable. Thank you in advance for any help. Izman .