How to open a synchronous dialog in Flex? I need to call a function from an external interface (JavaScript) that will open a simple dialog in a Flex application and return a value according to the button that the user clicked (OK / Cancel).
Thus, it must synchronously access the dialog box, i.e. the call waits until the user closes a dialog like this one.
function onApplicationUnload():Boolean
{
var result:Boolean;
result = showDialogAndWaitForResult();
return result
}
Does anyone know how I can do this? I could write a loop that waits until the dialog box sets a flag and then reads the result to return it, but there must be something more elegant and reusable to wait for other asynchronous calls to complete.
EDIT:
Unfortunately, the callback does not work, because the JavaScript function calling onApplicationUnload () should return a value (similar to the onApplicationUnload () function in Flex). This JavaScript function has a fixed signature, as it is called by the framework, and I cannot change it. Or in other words: a call from JavaScript to Flex should also be synchronous.
source
share