7 Replies Latest reply on Jan 7, 2009 2:14 AM by Madhav Subedi

    How to Commune Flex with Html

    ggnaidu
      Hi ! Can any body help me how to communicate flex with html. My requirement is whenever I closed the browser I want to execute one event ? Please help me.
        • 1. Re: How to Commune Flex with Html
          Michael Borbor Level 4
          You could use the flash externalinterface to communicate with the html wrapper, and the use some javascript code to perform the action that you want.
          • 2. Re: How to Commune Flex with Html
            ggnaidu Level 1
            Thank you for ur reply sir.
            When the application is stand alone at that time it is working.When I run the application from Flex Builder I am able to execute the event. But my requirement is after closing the browser I want to invalidate the session. I am using Jboss server. In the web application I am not able to do this. Kindly help me.
            • 3. How to Commune Flex with Html
              Madhav Subedi Level 4
              you can call a flex function from javascript if you can trap the close event of the browser:
              javascript code:
              ----------------------
              function getFlexApp(appName) {
              if (navigator.appName.indexOf ("Microsoft") !=-1) {
              return window[appName];
              } else {
              return document[appName];
              }

              getFlexApp('flash_flex_appname').publicFlexFunction(params....);

              its all client side issue, and i dont think depends on the server; however it depends on javascript.
              • 4. Re: How to Commune Flex with Html
                ggnaidu Level 1
                The code what I written in "index.template.html" is not reflecting in the application. When I tried to view the html code of the application by using View source option the code written in the "index.template.html" is not displaying. It seems the files are dynamically generated. How to solve this problem ?
                • 5. Re: How to Commune Flex with Html
                  Madhav Subedi Level 4
                  :)
                  the flex builder automatically generates the html wrapper each time you run the application. however you can disable this option, or make a different html wrapper by yourself.
                  • 6. Re: How to Commune Flex with Html
                    ggnaidu Level 1

                    Thanks for ur reply.

                    Kindly help me, how to disable the option, in flexbuilder projects/properties/Flex Compiler it is disable and showing a message "since this project is compiled by server, these settings do not apply"


                    I wrote some code in "index.template.html" and by checking the ExternalInterface is there or not from .mxml I am able to execute an event when I closed the browser.I am able to do this by using "RunApplication" option in the Flex Builder.

                    If I deploy the same application in the Jboss server then I am not able to do this . The code what I written in "index.template.html" is not reflecting in the application. When I tried to view the html code of the application by using View source option the code written in the "index.template.html" is not displaying. It seems the files are dynamically generated. How to solve this problem ?

                    • 7. Re: How to Commune Flex with Html
                      Madhav Subedi Level 4
                      why dont you use different html wrapper file?
                      simply copy your index.template.html to default.template.html and write your javascript code in default.template.html... now whenever you build your flex app, flex builder generates index.template.html and you js code is safe in default.template.html. for output, browse default.template.html