SWF Train (swiff train)

A simple and flexible Rails helper for embedding SWFs in your views. Requires jQuery and jQuery SWFObject.

Installation

Install gemcutter if you haven’t already:

sudo gem install gemcutter
gem tumble

Get on the swiff train

sudo gem install swf_train

Usage

The following example assumes you’re using haml:

%html
  %head
    =javascript_include_tag %w(jquery-1.3.2.min jquery.swfobject.1-0-7.min)
  %body
    = swf 'my_swf.swf'
    = swf 'subdirectory/of/public/another.swf', :width => 500, :height => 300
    = swf 'http://example.com/yet_another.swf', :wmode => 'opaque'

Passing in FlashVars is easy:

= swf 'swf/foo.swf', :flashvars => {:foo => 'chacha', :bar => 250}

By default, a DOM element is automatically created based on a variation of the swf filename, but you can override it like so:

= swf 'swf/foo.swf', :dom_id => 'custom_dom_dom_doobie', :create_dom_container => false

See full auto-generated documentation at rdoc.info/projects/zeke/swf_train

Colophon

Copyright © 2010 Zeke Sikelianos. See LICENSE for details.