Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Transcoding AMF

Contributor ,
Mar 05, 2009 Mar 05, 2009
It is my desire to transmit some data encoded in Action Message Format (AMF3) over a socket to and from Flash. I need to know two things:

1) How to read AMF3 data off a Flash Socket object. I'm assuming it will come through as an array of bytes and that array of bytes must be decoded into actual Actionscript Strings/Arrays/Objects or whatever.

2) How to turn Actionscript vars into AMF encoded binary strings.

Surely there is some built-in flash object which can do this? AMFPHP encodes data into AMF for transmission and its Actionscript client code looks like the attached example.

That code appears to be AS2 and relies on the remoting and rpc classes

The other example is from Zend_Amf (a framework) that also uses AMF and they offer some AS3 code that uses NetConnection and Responder objects.

It would appear that these built-in flash primitives are built for Remote Procedure Calls and expect return values to be communicated. I don't see any actual transcoding of objects from/into AMF which is what I really want. Any help would be much appreciated.

TOPICS
ActionScript
594
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Mar 05, 2009 Mar 05, 2009
Responses to amf calls get decoded into native objects automatically. AMFPHP has as3/amf3 suport as well in recent versions.

But you can also do your own encoding in actionscript.

Check out the ByteArray class.
You can set the amf encoding version and use writeObject() to encode.
Encoding is either amf0 (as1 and as2) or amf3 (as3) version


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 06, 2009 Mar 06, 2009
LATEST
thanks so much!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines