A very simple example of communication javascript <-> flash:
<%= swf_tag("example", :width => 400, :height => 300, :mode => :dynamic, :id => "my_flash", :flashvars => {:message => 'Hello, World!'}, :parameters => {:allowScriptAccess => "always", :scale => "showall"}, :javascript_class => "ExampleClass") %>