views:

489

answers:

3

I am by no means a Ruby developer, but I code HAML for a ruby framework on my localhost.

I had originally put a file called vidgirlBox2.flv file and called to it within the HAML, but converted the file to a swf called vidGirl_home.swf .

This swf worked.

Until I made a simple change to the orginal .fla, and overwrote the vidGirl_home.swf .

It never worked again.

I tried swfObject, Unobtrusive Flash Object, the bare minimum of embedding a swf, everything.

Turns out, I get this message in my terminal when running my local server:

ActionController::RoutingError (No route matches "/Users/daniellevine/Desktop/vidgirlBox2.flv" with {:method=>:get}):


Rendering rescues/layout (not_found)

As you can tell, its looking for an old file. I'm not calling this file in any of my haml. I am confused as to how this flv wrote itself into the ruby (this is what I assume at least) .

This was my attempt at a workaround, but it seems that this code generates a rails compiler error. This could be just a simple naming convention error. Am I missing an quotation mark somewhere?

My New Embed Code :

      - if Rails.env.development?
      = javascript_include_tag "swfobject"
      - else
      %script{:src => "http://ajax.googleapis.com/ajax/libs/swfobject/2.1/swfobject.js"}
      - id ||= "flash"
      - filename ||= "/images/vidGirl/vidGirl_home.swf"
      - width ||= 440
      - height ||= 247
      - background ||= "#ffffff"
      - version ||= 9
      - base ||= '{base: "."}'

      %div{ :id => id }
        %strong You need to upgrade your Flash Player

      = javascript_tag "swfobject.embedSWF('/images/vidGirl/vidGirl_home.swf', 'vidGirl_home', '440', '247', '9.0.0', '/javascripts/swfobject/expressInstall.swf', {}, '/public/', {});"

Anyone know what might have happened? or better yet, how to fix this?

Thank you!!

A: 

It looks like the embed code you're using is trying to access the file via a local path (i.e. the path on your computer).

I'm not sure if this is a Rails app (or another Ruby framework) but you'll need to make the .flv/.swf file is in the same place as other static files.

For Rails apps, this would be inside the public/ folder. I do some Rails+Flash apps and I generally put the files in a public/flash/ directory.

Another option is to put the .swf/.flv file on an S3 account and access it via the direct S3 URL. This is nice for larger video files as it saves on bandwidth.

Callmeed
I have the set I'm trying to draw from in public but no luck. I'm guessing there are a few issues here.
Trip
Can you pasted your embed/swfobject code here?
Callmeed
%object{ :width =>"550", :height =>"400"} %param{ :name =>"movie", :value =>"/images/vidGirl_home.swf"} %embed{ :src =>"/images/vidGirl_home.swf", :width =>"550" height="400"}
Trip
+1  A: 

I'm not super Flash-savvy, but it looks like when you converted the file to a swf, it basically embedded your prior vidgirlBox2.flv file as a resource. My guess is that resource used to live on your desktop, so when you edited your fla file the local path got saved into the resource somehow. The error you are seeing would then be due to a bad resource path being called from within the flash file itself, not from the calls you are making in your haml markup, which look fine.

austinfromboston
Wow, that is way interesting. You are right, the .flv was on my desktop. However, the swf file is just a movie, and the only actionscript is an event listener of movie completion, to let it loop.But from what I'm guessing at, is that it might have saved it into something deeper than that. I assume the work around is to recreate the resource from scratch. But when I created another swf of a ball moving left and right, that wouldn't work either.
Trip
A: 

Last time I had this problem, one flash movie was trying to load another flash movie but the base path was wrong. So austinfromboston might be right, by converting the flv to a swf, it embedded your .flv in a swf.

How to get around this? Make sure the path in the .swf is releative not absolut. Then, you need to set the BASE param. Here is an example with swobject and HAML:

- if Rails.env.development?
= javascript_include_tag "swfobject"
- else
%script{:src => "http://ajax.googleapis.com/ajax/libs/swfobject/2.1/swfobject.js"}
- id ||= "flash"
- filename ||= "/swf/flashmovie.swf"
- width ||= 990
- height ||= 500
- background ||= "#ffffff"
- version ||= 9
- base ||= '{base: "."}'

%div{ :id => id }
  %strong You need to upgrade your Flash Player

= javascript_tag "swfobject.embedSWF('#{filename}', '#{id}', '#{width}', '#{height}', '#{version}', '/swf/express_Install.swf', {}, #{base}, {});"

The path /swf/flashmovie.swf means there is a folder swf in the public folder.

Kafka
Your code produces a compiler error. I posted what I wrote in my original question above.
Trip
I guess you mean a haml compile error, right? What error would that be?
Kafka