3 Replies Latest reply on Oct 29, 2006 7:17 PM by peterent

    PopUpManager Question

    im4LF
      For example I make simple application with TextArea (Log) and Button wich show Login form (TitleWindow)


      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">
      <mx:Script>
      <![CDATA[
      import mx.managers.PopUpManager;
      import mx.core.IFlexDisplayObject

      public function showLogin():void {
      Log.text += "Button clicked...\n";
      var wh:IFlexDisplayObject = PopUpManager.createPopUp(this, Login, true);

      Log.text += "Window created...\n";
      }
      ]]>
      </mx:Script>
      <mx:Button x="109" y="219" label="Button" click="{showLogin()}"/>
      <mx:TextArea x="10" y="10" width="164" height="201" id="Log"/>
      </mx:Application>


      Now question:
      why after creating Login form code (Log.text += "Window created...\n";) in function showLogin() is executing?
      How can I create some form, wich stop executing code, but after closing form, code executing will be continue

      PS: sory for my bad eng.
        • 1. Re: PopUpManager Question
          peterent Level 2
          I think the problem is this: click="{showLogin()}" when you used { } you placed an ActionScript expression which got executed and its result put in its place. When you use events, you should do it without the { }:

          click="showLogin()"

          Then when the button is clicked, the expression assigned to the click event will be executed.
          • 2. Re: PopUpManager Question
            im4LF Level 1
            quote:

            Originally posted by: peterent
            I think the problem is this: click="{showLogin()}" when you used { } you placed an ActionScript expression which got executed and its result put in its place. When you use events, you should do it without the { }:

            click="showLogin()"

            Then when the button is clicked, the expression assigned to the click event will be executed.


            Tnx for help, but Log contains "Window created..." before I close form :(((
            • 3. Re: PopUpManager Question
              peterent Level 2
              There is no way to stop or pause Flex (actually, the Flash Player) when you pop up a modal window. You must assign event listeners (eg, the "close" event) so you know when the user has dismissed the window. Take a look at the documentation for the Alert control. It shows how to use the Alert control to ask a question (eg, "Are you sure?" with Yes and No buttons).

              The Alert, while a modal pop-up, simply prohibits the user from doing anything but address the Alert. This is how Flex was designed - it is an event-driven system, not a procedural system.