Your code had all sorts of logic errors, especially with the onClientResourceStart, which was only being added when you ran draw.setVisible, but also being attached for all resources, instead of just the current one. It would never run for the current resource that way.

Your code had all sorts of logic errors, especially with the onClientResourceStart, which was only being added when you ran draw.setVisible, but also being attached for all resources, instead of just the current one. It would never run for the current resource that way.