Skip to content

Instantly share code, notes, and snippets.

@jwrubel
Created March 6, 2012 14:57
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jwrubel/1986681 to your computer and use it in GitHub Desktop.
Save jwrubel/1986681 to your computer and use it in GitHub Desktop.
swf_tag syntax in slim (should work for haml too)
= swf_tag "name_of_swf", \
options={:dom_id => "dom_element", \
:size => "320x240", :version => "10.1", \
:flashvars => {"a" => "test"}, \
:params => {"menu" => "false", "wmode" => "direct"}, \
:attributes => { "align" => "left", "class" => "flash_css_class" }}
div(id="dom_element")
@danam
Copy link

danam commented Mar 6, 2012

you can write the div like this: div#dom_element

@joepage
Copy link

joepage commented Mar 6, 2012

This doesn't appear to be working in Firefox.
http://www.codezen.com/2009/03/swfobject-firefox-and-blank-screens-oh.html
You can use the attributes parameter to pass in a class. if that class has a width/height set, this does work in firefox.

@jwrubel
Copy link
Author

jwrubel commented Mar 6, 2012

Code updated with @joepage 's feedback and syntax. If you are using this gist in your own code you need to replace the name_of_swf with the filename (obviously) and the dom_id parameter with the element you want to contain the swfobject. In the attributes hash, the class parameter needs to match a css class to style the swf embed. To work around the FF issue mentioned you need to have width and height properties associated with this CSS class.

@srbiv
Copy link

srbiv commented Mar 6, 2012

Any suggestions on what that width and height should be?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment