Connect SmartFox Server using Action Script 3 In Flash Builder 4.6

In this tutorial we are going to connect SmartFox Server using Action Script 3 in Flash Builder 4.6. Mostly you won’t get action script 3 code to connect smartfox server, here i’ll provide action script 3 source code at end of the tutorial.

At the end of the tutorial you came knw following this…

1. Action Script 3 code to connect SmartFox Server.

2. Action Script 3 SmartFox Server API.

3. Action Script 3 event listeners and etc..

Step 1: Create action script 3 project by going File -> New -> Action Script project.

Step 2: Once I created Action Script project, then I imported following action script packages in the project to utilize SmartFox Server  api to connect with server.

import it.gotoandplay.smartfoxserver.*;

Step 3: Then I instantiated SmartFoxClient class object using following syntax.

private var sfs:SmartFoxClient = new SmartFoxClient();

Step 4: By using connect() method we made a connection request to SmartFox Server.

sfs.connect(“127.0.0.1″,9339);

Step 5: Once the connection is success, the following event is triggered to indicate the connection was success.

sfs.addEventListener(SFSEvent.onConnection, onConnect);

Here is the whole source code.

If any problem to make a connection to the Server, let me know using below comment box.

Subscribe to get all tutorial updates, promotional offers and download links for all tutorials via E-Mail

Enter your email address:



Comments
  1. muni | Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">