rails / coffee-rails

CoffeeScript adapter for the Rails asset pipeline. Also adds support for .coffee views.
MIT License
230 stars 64 forks source link

ExternalInterface from Actionscript not working #67

Closed onesneakymofo closed 9 years ago

onesneakymofo commented 9 years ago

Hey all,

Just found a bug, and I'm not sure if it's Coffeescript or if it's coffee-rails. When you're using ExternalInterface in a .swf file to call a Javascript function, the function is being ignored. I had to convert my Coffee file back to Javascript for the .swf to work.

Just a heads up.

rafaelfranca commented 9 years ago

coffee-rails is just a integration of coffeescript with Rails. What you described seems to be a coffeescript problem.

sikachu commented 9 years ago

I'm pretty sure that's CoffeeScript bug, and that might be because they wrap generated JavaScript result in a closure by default. You can try by redefine your function attaching it to window object, and see if that work.

# Instead of
testing = ->
  alert("Hello!")

# Do this
window.testing = ->
  alert("Hello!")
onesneakymofo commented 9 years ago

Thanks @rafaelfranca. That's what I figured. I wanted to check here first just in case. @sikachu, I'll try it and see.