Your SlideShare is downloading. ×
AMF
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

AMF

2,135
views

Published on


0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,135
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
6
Comments
0
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. 用AMF來搭起美麗的橋樑 高見龍
  • 2. 高見龍 http://blog.eddie.com.tw aquarianboy@ptt eddie@adcube.com.tw aquarianboy@plurk eddiekao@facebook
  • 3. AMF = Action Message Format neither “A”dobe nor “A”ctionscript(雖然它是由Adobe制定的)
  • 4. wiki上的解釋 Action Message Format (AMF) is a binary format used to serialize ActionScript objects. It is used primarily to exchange data between an Adobe Flash application and a remote service, usually over the internet.
  • 5. 支援各種程式語言 .NET - FluorineFx (LGPL) PHP - AMFPHP, Zend_Amf, CakeAMFPHP Python - PyAMF, DjangoAMF Perl - AMF::Perl Ruby - RubyAMF ... 其它內容可參閱 http://en.wikipedia.org/wiki/Action_Message_Format
  • 6. PHP
  • 7. 1. 下載AMFPHP(目前是1.9版) http://amfphp.sourceforge.net/ 2. 把下載下來的壓縮檔解開,放在自己找得到的路徑就行了 例如: http://127.0.0.1/test/amfphp/ 3. 順利的話應該可以看到一個Service Browser(flex寫的) 連結: http://127.0.0.1/test/amfphp/browser 4. 在AMF gateway上新增一個服務(放到services資料夾裡) <?php class callme { function callmeplease($text) { return $text; } } 5. 重新整理service browser,應該可看到寫寫新增的內容 中文支援問題: 開啟AMFPHP資料夾的gateway.php,應該可以找到一段跟字碼有關的: $gateway->setCharsetHandler("utf8_decode", "ISO-8859-1", "ISO-8859-1"); 修改成: $gateway->setCharsetHandler("utf8_decode", "UTF-8", "UTF-8"); 或是如果你的PHP模組裡有iconv的話也可以這樣改: $gateway->setCharsetHandler("iconv","UTF-8","UTF-8"); 參考資料: http://blog.eddie.com.tw/2008/10/12/amfphp-tutorial 使用方法
  • 8. Django
  • 9. 1. 下載PyAMF(Stable版本 0.51) http://pyamf.org/community/download.html 2. 解壓縮後,進到資料夾裡執行setup.py或是ez_install進行安裝 3. 為展示目的,建立一個新的django project 參考資料 http://www.eddie.com.tw/course/index.php/Django_index 4. 為展示目的,建立一個新的django app,準備新增AMF service from pyamf.remoting.gateway.django import DjangoGateway def amfdemo(req, text): return 'hello from pyamf : ' + text services = { 'callme.callmeplease': amfdemo, } AMFGateway = DjangoGateway(services, debug=True) 5. 修改urls.conf url(r'^gateway/$', 'demoamf.dddd.views.AMFGateway') 使用方法
  • 10. Ruby on Rails
  • 11. 1. 使用RubyAmf plugin http://github.com/victorcoder/rubyamf_plugin 2. 為展示目的,建立一個新的RoR project,並進到project中安裝plugin(以rails 2.3.8為例) script/plugin install git://github.com/victorcoder/rubyamf_plugin.git 3. 安裝成功的話,可看見rubyamf的logo http://127.0.0.1:3000/rubyamf/gateway/ 4. 為展示目的,建立一個controller,並準備新增AMF service class DemoamfController < ApplicationController def callmeplease render :amf => "hello from rubyamf : " + params[0] end end 5. 預設的呼叫方法為ControllerName.ActionName 例如: DemoamfController.callmeplease 參考資料: http://blog.eddie.com.tw/2010/03/18/rubyamf 使用方法
  • 12. Thank You! 2010/10/27 ADcube Network, Inc. TEL +886-2-2370-0085 ext.501 FAX +886-2-2370-0125 9F., No.43, Sec. 1, Chongqing S. Rd., Zhongzheng District, Taipei City 100, Taiwan (R.O.C.) Welcome to visit http://www.adcube.com.tw for more information!