
Re: any example of client-server within the IDE in AS3.0?
I've only done limited client/server with Flash; doing a loop-back test with a PERL script running locally (to fake a server.)
The
Socket class is where you'll find all the Networking goodness. You connect to a server with
connect(), use events to get callbacks when "things" happen, and then I believe you read/write bytes like a ByteArray.
Code:
var socket:Socket = new Socket();
//socket.addEventListener( Event.CONNECT, onConnect );
//socket.addEventListener( Event.CLOSE, onClose ); // good to listen; in case of a disconnection
socket.addEventListener( ProgressEvent.SOCKET_DATA, onSocketData );
socket.connect( "127.0.0.1", 80 ); // host, port
...
function onSocketData( e:ProgressEvent ):void {
var bytes:ByteArray = new ByteArray;
bytes.endian = Endian.LITTLE_ENDIAN;
readBytes( buffer );
SomeAwesomeMessageHandler.getInstance().interpretNetworkData( buffer );
}
Hope that helps get you started.