How to prevent click through?
Copy link to clipboard
Copied
Basically I have mulitple buttons on the stage. Every button on the stage is an instance of the same component. When one of the buttons is pushed, that component imports an MC from the library to the stage (popup window). It then creates a text box and imports text into the box based on the XML settings typed in that components component inspector. The problem I keep running into is that I can still push the other component buttons through the mc that was imported to the stage.
I've tried the old way of fixing it. ie. make a button the size of the popup window and put it behine the window. This doesn't work.
I've tried using
stage.mouseChildren = false;
but that turns all the clicks off. Even the one that the user needs to close the popup window. I'm at a loss now. Any help you can give is much appreciated.

Copy link to clipboard
Copied
Well, it's a matter of design - there are various ways to tackle this. But putting a button behind the pop-up will work. But it needs mouse event listeners attached so it intercepts the clicks. Use a shape instantiated from the library, or simply draw one with the graphics API, and then attach listeners. That does work...
Copy link to clipboard
Copied
I'm not sure why. But adding a button behind it isn't working for me. Maybe it has something to do with the fact that all the buttons are components or maybe because all their instances of the same component. I don't know.
Is there a way the components can speak to eachother? Maybe I can set a global boolean value. When a button is clicked it sets it to true. Then if another button is clicked it checks to see if its true or false. It won't open if its true.
I don't know.

Copy link to clipboard
Copied
Sorry, I never use the button component... If you make a movie clip with a shape in it the size of your stage and use that as a mouse blocker, it will work. You just need to give it a CLICK listener for it to 'absorb' clicks and not let them pass through.
Are you sure, when you try this your blocker is above the other buttons you're trying to block?
Copy link to clipboard
Copied
It seems my problem is, each component has a button that's controlled by code in the components class. When the button is pushed, code in the components class creates an MC on the stage (the popup window). For some reason, even though the new MCs were created last, the buttons are still on top of the MC. Is there a way to fix this?
Copy link to clipboard
Copied
Are you adding the event listener to the individual buttons or the stage or what? Seems like you could add it to a containing sprite and evaluate whether or not you want the other ones active at the time with a allowClick flag or something. Or am I not reading the problem correctly.

