「RubyAMF」の編集履歴(バックアップ)一覧はこちら
「RubyAMF」(2008/04/05 (土) 01:25:21) の最新版変更点
追加された行は緑色になります。
削除された行は赤色になります。
**プラグイン名
RubyAMF
**このプラグインができること
+フロントエンドとなるFlashと、バックエンドとなる「何か」をつなぐためのAMF0またはAMF3を、Flash・RubyonRails間で使うためのプラグイン
+AMFはバイナリとしてデータ転送するので、大量のデータ転送時に効率が上がる(データ量や時間など)
+(自分自身まだよくわかってないものの)RPC的な使い方がメイン?
+ActionScript3用のFlash RemotingライブラリであるSuper Simple Remoting(http://ssr.riaforge.org/)を使うと、楽が出来る。
**対象バージョン
1.2系
**ちょー簡単な使い方
Rails側
>ruby script/plugin install http://rubyamf.googlecode.com/svn/trunk/
でインストールして、普通のコントローラーを作って
>ruby script/generate controller sample
普通のコントローラーにアクションを定義して
>class SampleController <ApplicationController
> def helloworld
> render :amf => "HelloWorld"
> end
>end
Flash(Flex)側
Super Simple Remoting(http://ssr.riaforge.org/)をインストールして、アクションスクリプトで
>import org.rubyamf.remoting.ssr.RemotingService;
>import org.rubyamf.remoting.ssr.ResultEvent;
>import org.rubyamf.remoting.ssr.FaultEvent;
>public class Main extends Sprite {
> public function Main() {
> var serv:RemotingService = new RemotingService(
> "http://192.168.1.160:8181/rubyamf/gateway",
> "SampleController"
> );
> serv.helloworld([], on_result, on_fault);
> }
> private function on_result(evt:ResultEvent):void {
> trace(evt.result);
> }
> private function on_fault(evt:FaultEvent):void {
> trace("ERROR");
> }
>}
ってやると、
>serv.helloworld([], on_result, on_fault);
により、Flash側からRails側のsampleControllerのhelloworldアクションがパラメータなしで呼ばれて、成功時ハンドラon_result,失敗時ハンドラon_faultのどちらかがコールされる。
もし
>serv.create([ {last_name:last_name.text, first_name:first_name.text} ], on_result, on_fault);
とやると、Rails側ではsampleControllerのcreateアクションの中で
>params[0][:first_name]
>params[0][:last_name]
でアクセスできる。
**公式ページ
[[http://code.google.com/p/rubyamf/]]
※RubyForgeから引っ越したみたい
※[[ここのサンプルソース>>http://code.google.com/p/rubyamf/downloads/list]]も使えるかも。(まだ見てない)
**日本語解説ページ
-[[beatspace.org blog>>http://www.beatspace.org/blog/archives/46]]
※チュートリアル風にRails→Flashでの受け取りまで。
-[[misscastの日記 rubyamf+flex+rails>>http://cucumber.g.hatena.ne.jp/misscast/20080108/1199762926]]
※Flash(Flex)→Railsの呼び出し
**外国語解説ページ
-[[RubyAMF. Flash. And Rails’ Params>>http://blog.rubyamf.org/?p=50]]
-[[AS3 + SSR, RubyAMF, and RESTful Rails>>http://www.dirtystylus.com/blog/2007/10/22/as3-ssr-rubyamf-and-restful-rails/]]
-[[Beginner's Tutorial to RubyAMF with RESTful Rails>>http://natureandtech.blogspot.com/2007/10/beginners-tutorial-to-rubyamf-with.html]]
※本家以外で初心者用の良いチュートリアルは今のところ見つけられていない。てか、本家もあまりドキュメントとしては良くない。
**のうはう
ええと、SSRに関する資料が不足しているな。
まず、ダウンロードとかsubversionリポジトリをチェック。
-[[ssr本家>>http://ssr.riaforge.org/]]
ここのサンプルソースは見ておくべし
-[[旧本家?>>http://osflash.org/projects/ssr]]
カスタムエラー処理の書き方
あと、認証失敗処理も書けるみたい
-[[Handling Awkward Remote Service Logic>>http://blog.rubyamf.org/?p=12]]
一時的に
WebORBプラグイン
[[ An alternative of BlazeDS - Rails and WebORB>>http://www.stbbs.net/blog/2008/01/alternative-of-blazeds-rails-and-weborb.html]]
※実現可能な事はRubyAMFと同じで、アプローが違うらしい
**コメント
#pcomment(reply)
**プラグイン名
RubyAMF
**このプラグインができること
+フロントエンドとなるFlashと、バックエンドとなる「何か」をつなぐためのAMF0またはAMF3を、Flash・RubyonRails間で使うためのプラグイン
+AMFはバイナリとしてデータ転送するので、大量のデータ転送時に効率が上がる(データ量や時間など)
+(自分自身まだよくわかってないものの)RPC的な使い方がメイン?
+ActionScript3用のFlash RemotingライブラリであるSuper Simple Remoting(http://ssr.riaforge.org/)を使うと、楽が出来る。
**対象バージョン
1.2系
**ちょー簡単な使い方
Rails側
>ruby script/plugin install http://rubyamf.googlecode.com/svn/trunk/
でインストールして、普通のコントローラーを作って
>ruby script/generate controller sample
普通のコントローラーにアクションを定義して
>class SampleController <ApplicationController
> def helloworld
> render :amf => "HelloWorld"
> end
>end
Flash(Flex)側
Super Simple Remoting(http://ssr.riaforge.org/)をインストールして、アクションスクリプトで
>import org.rubyamf.remoting.ssr.RemotingService;
>import org.rubyamf.remoting.ssr.ResultEvent;
>import org.rubyamf.remoting.ssr.FaultEvent;
>public class Main extends Sprite {
> public function Main() {
> var serv:RemotingService = new RemotingService(
> "http://192.168.1.160:8181/rubyamf/gateway",
> "SampleController"
> );
> serv.helloworld([], on_result, on_fault);
> }
> private function on_result(evt:ResultEvent):void {
> trace(evt.result);
> }
> private function on_fault(evt:FaultEvent):void {
> trace("ERROR");
> }
>}
ってやると、
>serv.helloworld([], on_result, on_fault);
により、Flash側からRails側のsampleControllerのhelloworldアクションがパラメータなしで呼ばれて、成功時ハンドラon_result,失敗時ハンドラon_faultのどちらかがコールされ、もし成功していたら
> trace(evt.result);
ではRailsから"HelloWorld"が渡ってくる。
もし
>serv.create([ {last_name:last_name.text, first_name:first_name.text} ], on_result, on_fault);
とやると、Rails側ではsampleControllerのcreateアクションの中で
>params[0][:first_name]
>params[0][:last_name]
でアクセスできる。
**公式ページ
[[http://code.google.com/p/rubyamf/]]
※RubyForgeから引っ越したみたい
※[[ここのサンプルソース>>http://code.google.com/p/rubyamf/downloads/list]]も使えるかも。(まだ見てない)
**日本語解説ページ
-[[beatspace.org blog>>http://www.beatspace.org/blog/archives/46]]
※チュートリアル風にRails→Flashでの受け取りまで。
-[[misscastの日記 rubyamf+flex+rails>>http://cucumber.g.hatena.ne.jp/misscast/20080108/1199762926]]
※Flash(Flex)→Railsの呼び出し
**外国語解説ページ
-[[RubyAMF. Flash. And Rails’ Params>>http://blog.rubyamf.org/?p=50]]
-[[AS3 + SSR, RubyAMF, and RESTful Rails>>http://www.dirtystylus.com/blog/2007/10/22/as3-ssr-rubyamf-and-restful-rails/]]
-[[Beginner's Tutorial to RubyAMF with RESTful Rails>>http://natureandtech.blogspot.com/2007/10/beginners-tutorial-to-rubyamf-with.html]]
※本家以外で初心者用の良いチュートリアルは今のところ見つけられていない。てか、本家もあまりドキュメントとしては良くない。
**のうはう
ええと、SSRに関する資料が不足しているな。
まず、ダウンロードとかsubversionリポジトリをチェック。
-[[ssr本家>>http://ssr.riaforge.org/]]
ここのサンプルソースは見ておくべし
-[[旧本家?>>http://osflash.org/projects/ssr]]
カスタムエラー処理の書き方
あと、認証失敗処理も書けるみたい
-[[Handling Awkward Remote Service Logic>>http://blog.rubyamf.org/?p=12]]
一時的に
WebORBプラグイン
[[ An alternative of BlazeDS - Rails and WebORB>>http://www.stbbs.net/blog/2008/01/alternative-of-blazeds-rails-and-weborb.html]]
※実現可能な事はRubyAMFと同じで、アプローが違うらしい
**コメント
#pcomment(reply)