Getting started with AMF

Source: Internet
Author: User

We all know about the AMF protocol in the Flash field. Currently, there are two versions of the AMF protocol. The changes from AMF0 to AMF3 are also great. Next we will take a closer look at the communication protocol exclusively developed by Adobe. It is also the AMF protocol, the core technology of Flash Remoting.

What is AMF? What are its advantages? Why does Flash Remoting choose to use AMF and discard the communication between SOAP and Flash Player?

Flash 5 can start to send data to the server in XML or "variable/value" pair output format. Although the data can be automatically parsed by the Flash compiler or manually parsed by the Code Compiled by developers, however, the parsing speed is slow. Because XML needs to process data layer by Node during the parsing process, and the Data Type processed in the matching format of XML and "variable/value" can only be of the classification type, the number is no exception. Flash Remoting can process complex data types, such as objects, structures, arrays, and even datasets. It can be used with the DataGrid component to conveniently display data 。

To process complex data types, it is imperative to use a unique method to transfer data between Flash and the application server. Therefore, the AMF Protocol came into being. AMF is an exclusive communication protocol developed by Adobe, it uses binary compression, serialization, deserialization, and data transmission to provide a lightweight and efficient communication mode between Flash Player and Flash Remoting gateway, as shown in 。

The biggest feature of AMF is that Flash built-in objects such as Object, Array, Date, and XML can be directly transmitted back to the server and automatically parsed to appropriate objects on the server, this reduces the complexity of developers' work and saves development time. Because AMF uses binary encoding, this method can compress data highly, therefore, it is very suitable for transferring a large amount of data. The larger the data volume, the higher the transmission efficiency of Flash Remoting, far exceeding the Web Service. For XML, LoadVars and loadVariables (), they use plain text transmission, and their efficiency cannot be compared with Flash Remoting 。

Note: Flash Remoting requires the browser to support Binary POST, and the Flash player is in Netscape 6. x. running Flash Remoting in the environment does not take effect (Flash Remoting calls have no effect and no error is returned ), netscape 7 has fixed this bug. This problem also exists for early Apple Safari and Chimera versions 。

It is also a lightweight Data Exchange Protocol, also by calling remote services, also based on standard HTTP and HTTPS protocols, why does Flash Remoting choose to use the AMF protocol and discard the communication between SOAP and Flash players? There are the following reasons:

SOAP processes data in XML format, which is too lengthy compared with the binary file system;

AMF can more effectively serialize data, because AMF was originally designed to support the data types of Flash ActionScript, but SOAP is committed to providing a wider range of uses;

AMF supports Flash Player 6, which only requires a browser to increase the size of around 4 KB (after compression), while SOAP is mostly used;

Some SOAP header file requests are not supported in Flash Player 6. Why does Flash Player 6 access the SOAP-based Web service? The Flash Remoting gateway used to convert the SOAP request on the server side to an atom file format, and then communicate with the Flash player using the atom file. In addition, the AMF package contains the onResult event (such as the response event) and onStatus events (such as error events), these event objects can be directly used in Flash 。

The AMF protocol has evolved from the AMF0 in the Flash MX era to the current AMF3. AMF3 is used as the default serialization format of the ActionScript 3.0 in Flash Playe 9, AMF0 is used as the serialization format of the old versions of ActionScript 1.0 and 2.0. AMF3 is more efficient in data transmission over the network than AMF0. AMF3 can transmit int and uint objects as integers, it also serializes data types supported by ActionScript 3.0, such as ByteArray, XML, and Iexternalizable 。

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.