View unanswered posts | View active topics


Reply to topic  [ 3 posts ] 
any example of client-server within the IDE in AS3.0? 
Author Message
Member

Joined: Wed Oct 14, 2009 5:35 am
Posts: 18
Post any example of client-server within the IDE in AS3.0?
hi !!.. friends..

I would like to make client-server in actionScript 3.0, I must send information since client to database server.

what do I do?


Mon Jul 18, 2011 4:18 am
Profile
Member

Joined: Thu May 15, 2008 7:36 pm
Posts: 605
Location: Baltimore, MD
Post 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.

_________________
http://tronster.com


Mon Jul 18, 2011 2:04 pm
Profile WWW
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 10740
Location: Paris, France
Post Re: any example of client-server within the IDE in AS3.0?
I think the question is about sending data to the server, not real-time communication between client & server, correct?

Solution is to use URLLoader from Flash to send your data to a server script, for instance written in PHP, which will store the data in a database.

There's an example here:
http://stackoverflow.com/questions/6093 ... h-with-php


Mon Jul 18, 2011 2:49 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.