public
Description: OpenLaszlo utilities: flash bridge, ajax, etc.
Homepage:
Clone URL: git://github.com/osteele/lzosutils.git
lzosutils / test / flashbridge / test-proxy.html
100644 38 lines (36 sloc) 1.415 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>FlashBridge: Test Proxy Objects</title>
    <script type="text/javascript" src="swfobject.js"></script>
    <script type="text/javascript" src="../../lib/flashbridge-browser.js"></script>
    <script type="text/javascript" src="log-calls.js"></script>
  </head>
  <body>
    <h2>Calls from the browser into the applet:</h2>
    <div id="applet">
      <p>The applet didn't load.</p>
    </div>
    <h2>Calls from the applet into the browser:</h2>
    <div id="output" style="font-family:monospace">
    </div>
    <script type="text/javascript">//<![CDATA[
      // Load the app, and tell FlashBridge to talk to it
      var swfUrl = "test-proxy.lzx?lzt=swf&lzr=swf8";
      swfobject.embedSWF(swfUrl, "applet", '100%', '50%', '8.0.0');
      FlashBridge.initialize('applet');
 
      // Set up an object for the applet to call
      var gBrowserObject = {
        h: function() { logCall('gBrowserObject.h', arguments) },
        j: function() { logCall('gBrowserObject.j', arguments) }
      };
      // Create a proxy to an object inside the applet...
      var gAppletObject = FlashBridge.createRemoteProxy(
        'gAppletObject', // its name within the applet
        ['f', 'g']); // its methods
      // ...and call it:
      gAppletObject.f(1, 2);
      gAppletObject.g(3);
      gAppletObject.f(4);
    //]]></script>
  </body>
</html>