2 Replies Latest reply on May 20, 2009 12:37 AM by Richard_Abbott

    Save As  on Alert message

    KalavatiSingh

        I  have a requirement where I want to open up a " Save as" Dailog box inorder  for user to save the files.
      I know that how to write the same code if i have a button using FileReference Class(http://blog.flexexamples.com/2008/08/25/creating-a-filereference-object-using-mxml-in-flex)
      But I want to write the same kind of code when an alert pops up asking to save (YES/NO) & I click yes.In nut shell I want to the above functionality but not on Button.
      Hope I am clear in explaining the requirement.If not get back to me so as to understand the requirement I

       

       

      Regards

      Kalavati Singh

      kalavati_singh@yahoo.co.in

        • 1. ussed Re: Save As  on Alert message
          KalavatiSingh Level 1

          private function someFn():void{
          //function where you are calling you alert popup
          Alert.show("SomeMessage", "Confirmation Window", Alert.YES|Alert.NO, null, handleConfirmation);

           

          }

           

          private function handleConfirmation(event:CloseEvent):void{
          if(event.detail == Alert.YES)
          //logic which you initially calling on button click
          }

           

          You can ge the code for Button click on (http://blog.flexexamples.com/2008/08/25/creating-a-filereference-object-using-mxml-in-flex)

           

           

          Let me know if any issue.

           

           

          Regards

          Kalavati

          • 2. Re: ussed Re: Save As  on Alert message
            Richard_Abbott Level 3

            Kalavati,

            it is also worth remembering that unlike typical desktop applications, a Flex dialog such as an Alert box does not block execution of other parts of your program. You can see this, for example, if your code pulls up several Alerts in a row - they will appear to the user to be displayed in reverse order as the execution flow "behind" the alert window continues. So box #2 is shown after/above box #1 etc. There is (so far as I know) no way to alter this as Flex has been deliberately designed to be non-blocking in this way.

            So in your code you must make sure in some architectural way that you are not assuming that execution will stop until the user has responded.

            Richard