Thanks guys. Stromausfall's solution works best in my case because I have several balls and they can have independently actions on or off.
But thanks for everyone.