要認(rèn)識flash remoting,就必須先知道amf(actionscript message format)。
    AMF is the Action Message Format. AMF is a proprietary data format created by Macromedia (now Adobe) and used by different mediums: Flash Remoting, ByteArray, IExternalizable, NetConnection, NetStream, LocalConnection, Shared Objects and more.(引用自osflash.org
    ActionScript Messaging Format (AMF) is a binary protocol meant to allow a Flash application, sitting on the user's browser, to communicate with the backend web server. AMF enables developers to build powerful flash-based applications driven by databases and rich business layers. (引用自amfnet.openmymind.net
    其實(shí),可以簡單地理解amf就是對flash的action script腳本中定義的數(shù)據(jù)類型(包括布爾,數(shù)字,數(shù)組,類等等)的二進(jìn)制的格式約定(可能說的有些偏差,基于現(xiàn)在的水品,先這樣理解吧:-)。因?yàn)槎M(jìn)制的傳輸是高效的,無歧義的,可以高壓縮的,這可能是macromedia(現(xiàn)adobe)采納的原因吧(Maybe:-)。
    下面的信息來自(ria.richtechmedia.com/category/%e9%8f%88%e7%b5%90/tutorials/page/2/
   

Flash remoting是一種連接flash client 與 server端的技術(shù),它的功用就像是 web service, xml, loadVars一般,可以在兩者之間交換資料,達(dá)到動態(tài)置換內(nèi)容的目地。

Flash remoting特別的地方在於它採用macromedia獨(dú)家的AMF(Action Message Format),這是一種 binary format的資料型態(tài),透過 AMF over HTTP的方式將flash端資料編碼後傳回server,server端的remoting adaptor接收到資料後則會解碼回正確的native物件,交給正確的程式處理。

AMF除了用於Flash remoting外,也廣泛的用於 Local Connection 與 Flash communication server,它最大的特色在於可直接將flash native object,例如Object, Array, Date, XML,傳回server端,並且在server端自動進(jìn)行轉(zhuǎn)譯成適當(dāng)?shù)奈锛鏵lash 的Array傳回PHP時(shí)就會自動轉(zhuǎn)換為 Associative Array;這個特色對開發(fā)者最大的好處在於不需要再人工處理serialization 與 deserialization的繁複工作,不但精確度更高,同時(shí)開發(fā)也更省時(shí)間。

由於AMF是binary format並且編碼時(shí)經(jīng)過高度壓縮,因此非常適合用來傳遞大量的資料,根據(jù)flashorb網(wǎng)站的測試(主要針對web service與flash remoting),當(dāng)資料量越大時(shí),flash remoting的傳輸效能就越高,遠(yuǎn)遠(yuǎn)超過web service的表現(xiàn),因此同樣的道理也可得知xml, loadVars, loadVariables 等使用plaine text format的傳輸方式自然也無可比擬。

至於在server端,目前macromedia官方支援的平臺有三種,分別是 Java Coldfusion(但實(shí)際上Coldfusion應(yīng)該只算是java的subset,它是一種 scripting tag library)與.NET,但由於AMF格式已被玩家反組譯成功,因此很快的就在Open Source圈出現(xiàn)各種「民間版」的remoting替代方案,其中比較有名的是:

-AMFPHP: 這是php版的remoting
-OPENAMF: java版的remoting
-Flap: Perl 與Python版的remoting
-FlashORB: 商業(yè)版的remoting替代方案,目前支援java與.net

另外,我補(bǔ)充一些:

amf.net:.net版的remoting

fluorine:.net版的remoting



文章來源:http://tangwei312tom.blog.163.com/blog/static/224731922008227102437496