Flex Panels and Windows Sample Source Code:
Create a file:
AlertDemo.mxml
|
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" backgroundAlpha="0" xmlns="*"> <mx:Script> import mx.controls.Alert; import mx.events.CloseEvent; private function clickHandler(event:Event) : void { Alert.show("Do you want to save your changes?", "Save Changes", 3, this, function(event:CloseEvent):void { if (event.detail==Alert.YES) status.text="You answered Yes"; else status.text="You answered No"; }, null, Alert.YES); } </mx:Script> <mx:Panel width="100%" height="100%" horizontalAlign="center" paddingTop="20"> <mx:Text text="Click the button below to display a simple Alert window" width="100%" textAlign="center"/> <mx:Button label="Click Me" click="Alert.show('Hello World!', 'Message')"/> <mx:Text text="Click the button below to display an Alert window and capture the button pressed by the user" width="100%" textAlign="center"/> <mx:Button label="Click Me" click="clickHandler(event)"/> <mx:Label id="status"/> </mx:Panel> </mx:Application>
|