views:

80

answers:

2

I was searching on google for it, I couldn't find it.
I would like to know how can I listen to sockets using actionscript 3

+1  A: 

You can't do this directly in Flash. You can however do it through an AIR application starting in AIR 2.0. You can download the AIR 2.0 Beta here: http://labs.adobe.com/downloads/air2.html

I know that's not exactly the answer you were hoping for, but I hope it helps.

EDIT: As an extra note, I've done it in AIR 2, and it is pretty is easy to get up and running.

Tyler Egeto
So How do people makes online games without receiving information from the server? o_o
M28
Well typically, you would make a socket connect from Flash, not receive one. So you might have a Java based SocketServer running to handle the communication. You might want to explore the new peer-to-peer stuff in Player 10
Tyler Egeto
Also note, if you wanted to create an AIR SocketServer, you can run it on a server that your Flash applications could connect to, basically exactly the same as you would with a JAVA solution.
Tyler Egeto
I am talking about the nonoba api or others apis, how do the client receive information about the server?
M28
Nonoba has a serverside application you communicate through. They are using one built on #C as appose to JAVA, but same idea.
Tyler Egeto
I mean, How do the CLIENT receive information?
M28
In Flash you create socket and connect to the server side application. Once that connection is made, you can send/receive information. But you can not receive connections, only create, and rely on the server app to shuttle information between users.
Tyler Egeto
Oh, I understand, I need a java server to forward the information to the main server?
M28
No sorry, I'll try to be clearer. Basically you would have an application running (JAVA or similar). Your flash applications would connect to it. All data would go to this application, and it would share that data with any other players connected. The JAVA application IS the server.
Tyler Egeto
What about this:The java collect the information about the clients, then it sends it to the flash server.
M28
I'll make the server using AIR, thank you so much :)
M28
Ya, that great solution, lets you stay entirely in AS
Tyler Egeto
I gonna need to update my flash T_T, anyway, thanks a lot.
M28
+1  A: 

Check out the Socket and XMLSocket classes.

aib