for (int i = 0; i < X; i++) {
node.addControl(new MyControl(i));
}
//after a while...
for (int i=0;i<spatial.getNumControls();i++) {
((MyControl)spatial.getControl(i)).setEnabled(false);
}
Only the first istance of MyControl gets the setEnabled() call. I suspect this is a bug… (JME 3.1)
The internal code seems to be fine, I would check first if the for is being iterated X times. After that, I would check (system.out can do it) the hashcodes of the controls (when adding and when disabling them).