<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="alertPopUp()" width="100%" height="100%"> <mx:Script> <![CDATA[ import mx.controls.Alert; import mx.events.CloseEvent; private var alertCount:Number = 1; private function alertPopUp():void{ mx.controls.Alert.show("This is Alert # " + alertCount++ + "\nClick Yes to launch another popup or No to quit", "Choose yes or No", 3, this, alertClickHandler); } private function alertClickHandler(event:CloseEvent):void { if (event.detail==Alert.YES){ alertPopUp(); } else { mx.controls.Alert.show("You saw " + alertCount + " alerts", "Results"); } } ]]> </mx:Script> </mx:Application>