2 Replies Latest reply on Oct 4, 2011 8:16 AM by PaddyMc2010

    Exit an I.E Browser from Flex

    PaddyMc2010

      Hi all,

       

      I was wondering is there anything in flex that i can use to close an internet explorer window?  I have a menu bar that i want to use with a file/exit menu option that will unload the the entire i.e window.

       

      Can this be done in Flex?

       

      Would anyone be able to advise?

       

      Thanks

       

      Patrick

        • 1. Re: Exit an I.E Browser from Flex
          pjoshi_infocepts Level 1

          Hi,

           

          We can close I.E. window from flex by using JavaScript. Here is the sample code -

           

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

          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"

                                                  layout="absolute">

            <mx:Script>

                                   <![CDATA[

                                                  public function jsCloseWindow():void

                       {

                         if (ExternalInterface.available)

                              ExternalInterface.call("closeWindow");

                       }

                              ]]>

                    </mx:Script>

                    <mx:Button x="10" y="10" label="Close Window" click="jsCloseWindow()"/>

          </mx:Application>

           

          Also you need to write javascript function"closeWindow()" in "html-template\index.template.html" file to close window -

           

          function closeWindow()

          {

                    window.close();

          }

           

          Hope this will help you.

           

          I am not sure if there is any other way to achieve this from flex.

           

          Thanks and Best regards,

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

          Pallavi Joshi | pjoshi@infocepts.com | www.infocepts.com

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

          • 2. Re: Exit an I.E Browser from Flex
            PaddyMc2010 Level 1

            Many thanks.  Ill give this a go.

             

            Patrick