4 Replies Latest reply on Feb 27, 2009 3:19 AM by khanou

    Problem Change Text In Alert

    khanou
      Hi,

      I have a problem to change the text of Alert after it creation.

      My Alert is create with the methode Alert.show("toto"). I put after the "OK" button to unvisible and I do my work normaly.

      When my work is done I do button.visible = true.

      All is right but I would like to change the text according to my work's result. (myalert.text = "succes" / "fail"). The button apeart but the text didn't change.

      I have try this.invalidateProperties() and this.invalidateDisplayList();

      Any Idea??

      Thanks,
        • 1. Re: Problem Change Text In Alert
          Richard_Abbott Level 3
          khanou,
          why not do the work before you ever call Alert.show()? Is there something crucial about doing the work while this is showing? If so, then maybe you need to look at other popup windows (eg see Help on TitleWindow and PopupManager)
          Richard
          • 2. Re: Problem Change Text In Alert
            khanou Level 1
            Hi,

            I use the Alert to block the user until my work (data base treatment) is not finish. So if I use an TitleWindow with PopUpManager I will obliged to catch All Mouse Event and KeyEvent to make It enable while the PopUp is open I think.
            • 3. Re: Problem Change Text In Alert
              Richard_Abbott Level 3
              khanou,
              I'm sure you are already aware that although the Flex interface is disabled (and hence the user cannot fiddle with inputs, buttons etc), other processing continues to happen. However, I do have a better idea what you are wanting to do with it now for which thanks.
              I think though you will have to create your own control. If you look at the Flex help on Alert you find that the show() method is static. So it is a class method rather than a method attached to a specific alert instance - ie you just say Alert.show() rather than var alert: Alert; alert.show();
              I suspect that what you are wanting to do requires having an alert object for which you can then change the text property. Things like the yesLabel property and so forth are again static properties, so they affect every instance of the Alert box _after_ they have been set, not pre-existing ones.

              Richard
              • 4. Re: Problem Change Text In Alert
                khanou Level 1
                Ok Richard.

                Thanks for all, I will try to create my own control.