1 Reply Latest reply on May 14, 2008 9:48 PM by atta707

    display alert hit okay page redirects

    nrutter
      I am having an issue here....When my page is updated I want to display an alert that says updated. You must hit okay and then the page redirects. The problem I am having with the below code is that when you hit save it displays the pop up for about two seconds I never click okay and the page redirects. I want the page to stop I must click okay for the redirct to occur. Any help would be great

      Alert.show('Updated', 'Alert Box', mx.controls.Alert.OK);
      var u:URLRequest = new URLRequest(' http://' + model.serverName+'/admin.cfm');
        • 1. Re: display alert hit okay page redirects
          atta707 Level 2
          move your URLRequest code to the clickListner function of the Alert as described in this example in FB help:

          <?xml version="1.0"?>
          <!-- controls\alert\AlertEvent.mxml -->
          <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml">

          <mx:Script>
          <![CDATA[
          import mx.controls.Alert;
          import mx.events.CloseEvent;

          private function alertListener(eventObj:CloseEvent):void {
          // Check to see if the OK button was pressed.
          if (eventObj.detail==Alert.OK) {
          myText.text = myInput.text;
          }
          }
          ]]>
          </mx:Script>

          <mx:TextInput id="myInput"
          width="150"
          text="" />
          <mx:Button id="myButton"
          label="Copy Text"
          click='Alert.show("Copy Text?", "Alert",
          Alert.OK | Alert.CANCEL, this,
          alertListener, null, Alert.OK);'/>
          <mx:TextInput id="myText"/>
          </mx:Application>