Posts

Showing posts from February, 2012

Actionscript function to handle confirm and cancel in Flex.

Actionscript function to handle confirm and cancel in Flex. In short, the code shows how to create an Alert control which has 2 buttons YES and Cancel that act as confirm function in Actionscript. First create a button component which the user presses to launch the update function. The click event launches the dialog box seeking confirmation and giving the user the option to confirm or cancel the update operation. The code specifies that update_function() should be used to process the user choice. import mx.controls.Alert; public function somethingGotClicked(event:MouseEvent): void { Alert.show( 'Do you wish to do something?' , 'Confrim' ,Alert.OK|Alert.CANCEL, this ,confirmAlt, null ,Alert.OK); } public function confirmAlt(event:Object): void { if (event.detail==Alert.OK) { // perform the operation } else if (event.detail==Alert.CANCEL) { // cancel the operation } } Adobe Flex is