The AMF protocol simplifies FLASH work

Source: Internet
Author: User
Tags nets

In Flash development, tedious server transmission work has always been a headache for developers. However, the emergence of the AMF protocol simplifies the work. Next we will briefly introduce the protocol that can be directly built into Flash. The biggest feature of the AMF protocol 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 Bin ary POST, and the Flash player is in Nets cape 6. x. running Flash Remoting in the environment does not take effect (Flash Remoting calls have no effect and no error is returned ), nets cape 7 has corrected this B u g. This problem also exists for early versions of Sa fari and Chim era apple. It is also a lightweight Data Exchange Protocol, also by calling remote services, it is also based on the standard HTTP and HTTPS protocols. Why does Flash Remoting discard the communication between SOAP and Flash players when using AMF:

SOAP processes data in XML format, which is too lengthy than the binary file system. AMF can serialize data more effectively. Because AMF was originally designed to support the data types of Flash ActionScript, however, SOAP is designed to provide a wider range of applications. To support Flash Player 6, AMF only requires a browser to increase the size by 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 。

In Flash Remoting MX, AMF has this feature, but here it is an information encoding format. It does not generate information data, it is used to encode and decode the data transmitted between the Flash video application and remote services through HTTP 。

Because AMF is an information encoding format designed for the ActionScript object model, it is very efficient for Flash film applications that use Flash Remoting MX 。

AMF is the full name of Action Message Format, which is a binary data Format designed for the ActionScript object model. It sends and receives information from remote services, flash Remoting MX uses Action Message Format. With AMF, Flash Remoting MX can encode and decode data transmitted between Flash video applications and remote services over HTTP 。

The AMF Protocol complies with the Simple Object Access Protocol (SOAP) Protocol format. It uses the information package format to transmit information in segments. An AMF information package contains the following five parts 。

(1) Information header, which contains the AMF version information 。

(2) count the top and bottom relationship headers 。

(3) configure the upstream and downstream headers. the upstream and downstream headers contain descriptions about how an independent AMF information is processed 。

(4) Count information 。

(5) Information configuration 。

On the client side, server method requests are automatically serialized to AMF format using NetServices or Service methods. on the server side, Flash Remoting MX deserializes AMF information 。

When the server completes processing, the results are serialized into the AMF format and sent back to the Flash video application. The AMF protocol information format created by the server is the same as the AMF information format created by the client 。

A separate AMF protocol information package contains error or response objects, which are expressed as an ActionScript object 。

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.