1

I want to a framework to pass objects between Java and AS3 using sockets. It should be something with good performance (not XML, JSON). I have looked into AMF but all of the tutorials are very complex and not about what I need. I have used java to java serialization but I can't find any tutorial about Java to AS3.

Does anyone know a good tutorial?

Rob Fox
  • 5,355
  • 7
  • 37
  • 63

4 Answers4

2

For fast, efficient inter-language serialization, you might consider Protocol Buffers. Java is a first-class supported language for protocol buffers, while there are third-party add-ons for ActionScript.

Michael Aaron Safyan
  • 93,612
  • 16
  • 138
  • 200
  • I tried protoc-gen-as3 before but never got the plugin to work. Mainly because the documentation is in chinese and lacking. – Rob Fox Jul 04 '11 at 09:02
2

You could also use a BlazeDS messaging service for this.

Unless you really have a specific need for sockets, this would definitely be a leap forward. It can be considered as a "standard" for creating flex-java apps.
It has all the hooks for easily creating apps with AMF support out of the box.

BlazeDS also integrates well with other technologies like Spring, Maven, ...

Some tutorials you can easily find with some basic googling:

http://learn.adobe.com/wiki/display/Flex/Creating+a+BlazeDS+messaging+application+in+Flex+Builder
http://sebastien-arbogast.com/2008/04/10/flex-spring-and-blazeds-the-full-stack/
http://www.horochovec.com/2010/03/29/flash-builder-flex-sdk-4-java-blazeds-tutorial/

Dennis Jaamann
  • 3,547
  • 2
  • 23
  • 42
  • How well does this work in a multiplayer game environment with a very high traffic? – Rob Fox Jul 04 '11 at 09:19
  • Not very, hence the statement "Unless you really have a specific need for sockets". In your case you will probably need real-time connections and in that case BlazeDS just won't cut it. LCDS might, but is too expensive imho. – Dennis Jaamann Jul 04 '11 at 09:25
  • I guess Protocol Buffers is the better option then. – Rob Fox Jul 04 '11 at 09:27
  • You can also send AMF data through a binary socket. You could even use blazeDS serialization/deserialization jars to handle the serialization for you. There is an open source tool called Merapi => http://code.google.com/p/merapi/ that uses this principle. Maybe you can look at the source code and go from there. – Dennis Jaamann Jul 04 '11 at 09:41
  • There are different issues here: server load, network traffic. I doubt that you issues related to the data compression format (and choose protocol buffers over amf or hessian). Mostly I think that you need a high performance messaging server. – Cornel Creanga Jul 05 '11 at 15:41
1

I would suggest you look at SmartFoxServer or Wowza if you want it for a multiplayer streaming server. SmartFox has more of a 'gaming' edge to it while Wowza is more general purpose streaming. I believe Wowza is also part of the Amazon cloud services, which means low startup cost.

J_A_X
  • 12,857
  • 1
  • 25
  • 31
1

What I ended up using the parts of BlazeDS that deal with Java AMF decoding and encoding (flex-messaging-common.jar and flex-messaging-core.jar). http://www.riaspace.com/2010/02/java-as3-serialization-with-amf/ was of help there.

Also a relevant topic: AS3 unable to decode AMF3 object from socket sent by Java

Community
  • 1
  • 1
Rob Fox
  • 5,355
  • 7
  • 37
  • 63