开发者

Embedding a flash file (swf) in a rails application

How can we include 开发者_StackOverflow社区(nicely) a swf file in a Rails application?

By the way, I tried the swf_fu plugin but it didn't work. When I call my swf file located in the swfs directory, it tells me that the method is not found:

undefined method swf_tag

Thank you.


jQuery.tools FlashEmbed is the most popular way to cross-browse integration swf file into a page. you can do it this way:

flashembed("flash", "my_object.swf");

UPDATE for Rails 2.3.x, you can use custom helper to eliminate file caching on proxy/ISP side:

view:

<%= custom_assets('/swfs/my_object', '.swf') -%>

helper:

def custom_assets(source, ext)
  path = File.join(Rails.root, 'public', source) + ext
  asset_id = File.exist?(path) ? File.mtime(path).to_i.to_s : ''
  "#{source}?#{asset_id}"
end
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜