5 Replies Latest reply on Feb 7, 2009 8:12 AM by olegkon

    calling a java applet from flex

      heres an article on how to call a java applet form flex.

      can anyone else get this to work on a mac in firefox?

      http://tobiaspatton.wordpress.com/2007/08/29/using-a-signed-java-applet-as-a-flex-helper-p art-1/

      dose anyone know what the "document" argument is in the externalInterface call?

        • 1. Re: calling a java applet from flex
          cheers for the article,

          i've helped make a fairly flex/java intensive application and I use pretty much the same technique. The document argument is telling javascript that the object "helloWorldApplet" is part of the DOM. Its basically just a reference

          The application I use goes from Java to Flex not Flex to Java though like this document shows.

          Java calls Javascript functions
          Javascript does come computations
          Javascript communicates with flex via FABridge

          It makes a pretty nice application in the end too
          • 2. Re: calling a java applet from flex
            grolnb Level 1
            Thanks for the response.

            Is this article using the flex ajax bridge? I thought the bridge was for java script and not java applets.
            Is there a way to use the flex ajax bridge to call a java applet?

            Is the example is the java script calling the java applet from the html file?
            Dose anyone know where else i can read about whats going on in the example im still having trouble getting it to work?

            • 3. Re: calling a java applet from flex
              J_Fraser Level 1
              This article isn't using the FABridge, I only use that because my java applet calls javascript functions which in turn make calls to flex. My application personally doesn't call Java from Flex, only the other way round so I can't say much about it, but I imagine it wouldn't be too much different.

              The example seems to call the java applet straight from flex.


              ExternalInterface.call( "document.helloWorldApplet.sayHelloWorld()", null );

              this flex call runs the function sayHelloWorld() in the Java applet with the id "helloWorldApplet".

              So on your page you should have a flex applet, and a java applet with the id "helloWorldApplet", when you click on the flex button a button should appear in the helloWorldApplet.

              If you need more help post your code here, or more information and i'll try help
              • 4. calling a java applet from flex
                grolnb Level 1
                Thanks for the help. I can get the first example working.
                For the second example I think something is wrong with the applet tag.

                This is the applet tag Im using for the second example:

                <APPLET id="launcherApplet" archive="Launcher.jar" code="Launcher.class" align="baseline" width="200" height="200">

                The applet loads but the externalInterface call does nothing...
                my Launcher.jar file is in the same directory as the html file.
                Any ideas?

                Thanks again
                • 5. Re: calling a java applet from flex
                  olegkon Level 1
                  I tried that example, and it never connected to the applet (so far couldn't make SWF and Applet coexist
                  on the same HTML page, mostly generated by FB3),
                  but I was able to call JavaScript functions on that page.
                  By the way, JavaScript connection was breaking as soon as I tried to copy code generated by FB3
                  to another directory - no errors, just stopped working. Why?
                  Is that because it needs some SWC to use ExternalInterface ?

                  Also, is that possible to connect to the applet via Remoting ?
                  We have a high security application and using JavaScript is not safe.
                  Not sure if that is a concern, since SWF and applet reside on the same page.

                  Please advise,