1 Reply Latest reply on Sep 30, 2012 3:02 AM by Abhishek Chaudhary

    Closing a PopUp

    Captain825

      Hi....................HELP!!!!!!

       

      I posted this a while ago and still need help.

       

      I am using Flex 4.6 and I have a popup window where the user can fill out a form and it gets emailed to me through a php script when the submit button is clicked. That part works fine.

       

      All I need help on is that once the submit button is clicked, I would also like the popup window to close. Rather than explain the code, I think its better if I just show you the code.  I edited the url for obvious reasons....

       

      Based on the following, can you help me close the popup once the submit button is closed?

       

        ____________________________________________________________

      <?xml version="1.0" encoding="utf-8"?>

      <s:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009"

                              xmlns:s="library://ns.adobe.com/flex/spark"

                              xmlns:mx="library://ns.adobe.com/flex/mx"

                              width="400" height="600" title="CoFo - Login Help"

                              close="closeWindow(event);">

            

             <fx:Declarations>

                    <s:HTTPService id="login_email"

                                           url="http://www.XXXXXXXXXXXXXXXX"

                                           useProxy="false" method="POST">

                   

                           <mx:request xmlns="">

                                 <firstname>{first_name.text}</firstname>

                                 <lastname>{last_name.text}</lastname>

                                 <email>{email.text}</email>

                                 <username>{username.text}</username>

                                 <firmcode>{firm_code.text}</firmcode>

                                 <admin>{admin.selected}</admin>

                                 <para>{para.selected}</para>

                                 <comment>{comments.text}</comment>

                           </mx:request>       

                    </s:HTTPService>

             </fx:Declarations>

                   

             <fx:Script>

                    <![CDATA[

                           import mx.controls.Alert;

                           import mx.core.IFlexDisplayObject;

                           import mx.events.CloseEvent;

                           import mx.managers.PopUpManager;

                          

                           public function closeWindow(e:CloseEvent):void {

                                 PopUpManager.removePopUp(e.target as IFlexDisplayObject);

                           }

                    ]]>

                   

             </fx:Script>

            

             <s:TextArea x="32" y="10" width="332" height="229" editable="false" fontSize="11"

                                 text="We are sorry you are experiencing difficulties logging in to CoFo.  We are here to help.  Please review the following information before sending an email to Support.1. You must be a registered user to login to Cofo.  2. Your username and password must be set up by your system administrator prior to your logging in to CoFo. If you have been issued a username and password by your system administrator and still can't login, please complete this form and click on Submit. If you haven't been issued login credentials, please contact your system administrator. Thank you and we will work quickly to resolve your login issue."/>

             <s:Label x="33" y="258" text="First Name:"/>

             <s:Label x="33" y="290" text="Last Name:"/>

             <s:Label x="33" y="351" text="Username:"/>

             <s:Label x="33" y="383" text="Firm Code:"/>

             <s:Button x="317" y="533" label="Submit" click="login_email.send()"/>

             <s:Label x="33" y="439" text="Comment:"/>

             <s:TextInput id="first_name" x="107" y="248" width="258"/>

             <s:TextInput id="last_name" x="107" y="281" width="259"/>

             <s:TextInput id="email" x="107" y="311" width="259"/>

             <s:TextInput id="username" x="107" y="341" width="259"/>

             <s:TextInput id="firm_code" x="107" y="372" width="259"/>

             <s:TextArea id="comments" x="107" y="437" width="259" height="79"/>

             <s:RadioButton id="admin" x="160" y="407" label="Admin"/>

             <s:RadioButton id="para" x="264" y="407" label="Para"/>

             <s:Label x="33" y="322" text="Email: "/>

       

       

      </s:TitleWindow>

       

       

      I would appreciate your help.
      Thanks,

        • 1. Re: Closing a PopUp
          Abhishek Chaudhary

          Modify close function to following

           

          public function closeWindow(e:CloseEvent = null):void {

                                                  PopUpManager.removePopUp(this);

          }

           

          Modify submit button MXML as

           

          <s:Button x="317" y="533" label="Submit" click="login_email.send();closeWindow()"/>

           

           

          Thanks and Best regards,

          Abhishek

          ------------------------------------------------------------------

          Abhishek Chaudhary | achaudhary@infocepts.com

          Off: +91 712 224 5867 Ext:8358 ,  Mob: +91 992 358 8703

          ------------------------------------------------------------------