What is it?
protoc-gen-as3 is a Protocol Buffers plugin for ActionScript 3.
This project aims to support Protocol Buffers in ActionScript 3 with minimum API and best performance. protoc-gen-as3's serialize/deserialize performance is near native AMF's writeObject/readObject, although protoc-gen-as3 runs in AVM2 while writeObject/readObject runs natively.
I have implemented almost all protobuf features (more than any other protobuf's AS3 implementation) in protoc-gen-as3:
- All basic types
- Nested messages
- Packed and non-packed repeated fields
- RPC services
- Custom options for services and methods
- ActionScript metadata tag generation:
- Text format
- Unknown fields
These features are supported by Google's C++/Java/Python implementation, but not in protoc-gen-as3:
- Groups (a deprecated feature)
- Custom options for messages, enums and files
How to use it?
Dowload and extract this tarball.
Unlike other protobuf's as3 compilers, protoc-gen-as3 does not require you to modify original protobuf's source code. You can just use protoc binary (version 2.3+) with this plugin to generate ActionScript 3 source code:
Write your own code
Then, you can use the generated files to serialize and deserialize in protobuf format by invoking
Before compiling, don't forget to let your ActionScript 3 compiler include protobuf.swc and the generated source files.