views:

22

answers:

3

In my flex app I have some radio buttons. When a user clicks the radio button, I want to popup an Alert, and if the user clicks ok the radio button will change, otherwise their change will be discarded.

How do I accomplish that? I tried event.preventDefault(); while handling the click event, but that didn't do anything. Any other ideas?

A: 

You could listen for the valueCommit-event and try to stop the behaviour (changing the value) in an event handler. There you can also create a popup...

hering
A: 

Listen for the MouseEvent.MOUSE_DOWN event and in your handler do the following:

function myHandler(event:MouseEvent) : void {
  event.preventDefault();
  event.stopImmediatePropagation();
  // statements
}
Robusto
This doesn't stop the radio button from changing.
FigBug
+3  A: 
  • Listen to the change event.
  • If the new value of selected is true, set it to false and show the popup
  • Update the selected value based on the result of popup.
Amarghosh