FlashからデータをRailsに渡して、そのままデータをFlashへ返します。
Flash側
1フレーム目に以下のように記述
this.createTextField("r_txt",1,10,10,480,480);
this.r_txt.border = true
this.r_txt.text = "start";var lv = new LoadVars();
var rlv = new LoadVars();lv.data = "hoge"; // Rails側に送信するデータ
lv.sendAndLoad("http://localhost:3000/flash/hello/",rlv,"POST");rlv.target = this;
rlv.onLoad = function (s:Boolean){
if (s) {
this.target.r_txt.text = "result = " + this.result;
} else {
this.target.r_txt.text = "error";
}
};
Rails側
適当なコントローラーを作成
$ ruby script/generate controller flash
flash_controller.rb
class FlashController < ApplicationController
def hello
@data = @params["data"]
end
end
hello.rhtml
result=<%= @data %>



