molvisions
12-29-2005, 11:37 AM
hi,
I am trying to create an object and save a ref to it in another object's array:
function mainF(data) {
var H = new Hub(data);
subF(data);
return H;
}
function subF(data) {
// create the object
IB = new InfoBlock(data);
// save a ref to IB in a linked array set of the H object.
// id goes into one array, IB goes into the same position in another.
H.addInfoBlock(id, IB);
}
if I subsequently try to access the IB object by accessing the array in H, it returns undefined. if I try to access id from its array in H, though, it returns the correct value.
is my object is getting punked, or just the reference to it?
thanks!
tim
I am trying to create an object and save a ref to it in another object's array:
function mainF(data) {
var H = new Hub(data);
subF(data);
return H;
}
function subF(data) {
// create the object
IB = new InfoBlock(data);
// save a ref to IB in a linked array set of the H object.
// id goes into one array, IB goes into the same position in another.
H.addInfoBlock(id, IB);
}
if I subsequently try to access the IB object by accessing the array in H, it returns undefined. if I try to access id from its array in H, though, it returns the correct value.
is my object is getting punked, or just the reference to it?
thanks!
tim