I have two buttons, each is a sprite. I have one directly on top of the other, in different layers. They are more or less one button for "on" and one button for "off". You should only see and be able to click on one of them at at a time - like a toggle.
My first attempt I had them both in the same layer, and made one invisible by default (.e.g off). So the player only sees "on". When he clicks on the "on" button, I still get an onclick event on the off button, even thouh its invisible.
So attempt two, I tried making the active button on a higher layer, and visible, and the inactive button on a lower layer, and invisible. However, both buttons still seem to get pressed.
I see a few options:
1) destry and create a new button each time one is clicked, so only one button is active at any time.
2) Keep a button state global variable, and ignore the unwanted button events
3) I could try and move the inactive button off screen to try and make it unclickable, but I dont know what affect this will have on the layout in a browser.
I didnt see in the manual an explanation on how events pass down through layers. Has anyone seen such an article?