This page last changed on Jun 26, 2008 by stepheneb.

Flash can be embedded in MozSwing, both as part of html and as an swf file itself.

Here's an example (you can tell it's running inside Swing by noticing the Swing draggable control on the left):

Here's an example of some Ruby code running in Java (using the Java JRuby implementation) that embedds and then controlling a simple flash application.

In the code below I've commented out the line that loads the from a file url using what in effect is a relative reference (normally file:// urls don't work with relative references). Currently communicating to a flash file loaded from the filesystem doesn't work.

include Java

import org.mozilla.browser.MozillaWindow

win =
win.setSize(600, 600)
path = Dir.pwd
# win.load("file:///#{path}/flash/zoom-test2.html")

The screen shot below was taken during execution of the flash.zoom_in command.

This is how the flash object is embedded in the html:

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" 
width="550" height="400" id="zoom-test" align="middle" id="zoom">
<param name="allowScriptAccess" value="always" />
<param name="movie" value="zoom-test2.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<embed src="zoom-test2.swf" quality="high" bgcolor="#ffffff" width="550" height="400" 
name="zoom-test" id="zoom" align="middle" allowScriptAccess="always" 
type="application/x-shockwave-flash" pluginspage="" />

I think setting allowScriptAccess to always should allow communication to a flash app loaded from the file system but it isn't working yet.

Document generated by Confluence on Jan 27, 2014 16:53