Rails Plugin for swfobject? - swf_fu

Hi all,

I’ve been using a plugin called swf_fu which seemed fairly easy to
implement for adding flash content to my rails app. However, I’m trying
to pass a variable to my flash through rails and have the flash content
pick it up.

The variable is already retrieved in an earlier call to the database so
I don’t believe it’s any type of authentication string issue. Here’s
two examples:

<%= swf_tag “victory.swf”, :size => “250x75”, :div_id => “flbars”,
:flashvars => “victory_id=#{@virtuals_victory}”, :parameters => {:wmode
=> ‘transparent’} %>


<%= swf_tag “victory.swf”, :size => “250x75”, :div_id => “flbars”,
:flashvars => {:victory_id => @virtuals_victory}, :parameters => {:wmode
=> ‘transparent’} %>

As a generic test, I’m passing the following value with
@virtuals_victory by doing @virtuals_victory = 76.

In my flash I’m doing:

onSelfEvent (load) {
victoryID = this.loaderInfo.parameters.victory_id;

… which is going to pull the victory_id value sent to it through
swfobject’s flashvars.

When I pull it up, it doesn’t show the value and the source shows the


As you can see, right after the expressInstall, the flashvars hash is
showing “victory_id”:“76” in the first case and in the second case it
shows “victory_id”:76.

Does anyone have an idea of why flash isn’t retrieving the flashvars
with swfobject? I’ve checked the readme of the plugin and it says:

=== Options

  • :id - the DOM +id+ of the flash +object+ element that is used
    to contain the Flash object; defaults to the name of the swf in +source+
  • :width, :height - the width & height of the Flash object.
    Defaults to “100%”. These could also specified using :size
  • :size - the size of the Flash object, in the form “400x300”.
  • :mode - Either :dynamic (default) or :static. Refer to
    doc[GitHub - swfobject/swfobject: An open source Javascript framework for detecting the Adobe Flash Player plugin and embedding Flash (swf) files.]
  • :flashvars - a Hash of variables that are passed to the swf.
    Can also be a string like “foo=bar&hello=world”. Defaults to
    {:id => the DOM id}
  • :parameters - a Hash of configuration parameters for the swf.
    See Adobe’s
  • :alt - HTML text that is displayed when the Flash player is
    not available. Defaults to a “Get Flash” image pointing to Adobe Flash’s
    installation page. This can also be specified as a block (see embedding
  • :flash_version - the version of the Flash player that is
    required (e.g. “7” (default) or “8.1.0”)
  • :auto_install - a swf file that will upgrade flash player if
    needed (defaults to “expressInstall” which was installed by swf_fu)
  • :javascript_class - specify a javascript class (e.g.
    “MyFlash”) for your flash object. If it exists, the initialize method
    will be called.
  • :initialize - arguments to pass to the initialization method
    of your javascript class.
  • :div_id - the DOM +id+ of the containing div itself. Defaults
    to “#{option[:id]}”_div
  • :switch_off_auto_hide_show - switch off SWFObject’s default
    hide/show behavior. SWFObject temporarily hides your SWF or alternative
    content until the library has decided which content to display. Defaults
    to nil.

So, at this point I’m not understanding why I can’t get this to work.
I’ve also tried doing:

skip_before_filter :verify_authenticity_token

… on the controller processing the variable …

Any advice on this issue?

onSelfEvent (load) {
victoryID = this.loaderInfo.parameters.victory_id;

Everything was fine. The issue was actually in the flash software
itself. I use both macromedia and swishmax and swishmax2 and sometimes
I forget that each passes variables a bit differently.

The above should have appeared as:

onSelfEvent (load) {
victoryID = victory_id;