Hello,
I have a very strange problem. I've defined an global array 'cursor' like this:
cursor = new Array(5);
and then my function doSomething(evt, current) gets the value of 'current' and is supposed to access 'cursor[current].setAttribute()'
BUT, for some reason, when I try to do that I get:
"Type Error: cursor[current] has no properties" error.
So, then I tried to force 'cursor' array recognize index using conventional for-loop like this:
for (var i = 0; i < 5; i++) {
if (current == i) {
cursor.setAttributeNS(null, "x", cur_x);
cursor.setAttributeNS(null, "y", cur_y);
}
}
Still, I am getting error "cursor has no properties. BUT, if I access 'cursor' like this:
//use 1 here
cursor[1].setAttributeNS(null, "y", cur_y);
everything works fine. Could somebody please tell me what is going on here? It flies against rules of common sense as far I see. Thank you very much.
Victor.
I have a very strange problem. I've defined an global array 'cursor' like this:
cursor = new Array(5);
and then my function doSomething(evt, current) gets the value of 'current' and is supposed to access 'cursor[current].setAttribute()'
BUT, for some reason, when I try to do that I get:
"Type Error: cursor[current] has no properties" error.
So, then I tried to force 'cursor' array recognize index using conventional for-loop like this:
for (var i = 0; i < 5; i++) {
if (current == i) {
cursor.setAttributeNS(null, "x", cur_x);
cursor.setAttributeNS(null, "y", cur_y);
}
}
Still, I am getting error "cursor has no properties. BUT, if I access 'cursor' like this:
//use 1 here
cursor[1].setAttributeNS(null, "y", cur_y);
everything works fine. Could somebody please tell me what is going on here? It flies against rules of common sense as far I see. Thank you very much.
Victor.