How to connect? Can't get started!

Post here your questions about the Flash / Flex / Air API for SFS2X

Moderators: Lapo, Bax

Post Reply
delavega
Posts: 12
Joined: 25 Feb 2011, 19:32

How to connect? Can't get started!

Post by delavega »

I'm totally new to SmartFoxServer.

I installed the 2x version and everything's fine.

I have a book called Flash Multiplayer Virtual Worlds but it's based in SFS 1.X.

The server is working and the examples are working.

I have Flash CS5 installed.

I'm reading the documentation but can't find a detailed way just to connect from a simple .fla file to the server and trace it.

Next step would be to install a Java IDE, but first wanted to connect from the client using actionscript 3.

Any help is MUCH appreciated! I'm totally lost.

Many thanks!
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

Check the source code of the "connector" example provided with SFS2X?
Paolo Bax
The SmartFoxServer Team
delavega
Posts: 12
Joined: 25 Feb 2011, 19:32

Post by delavega »

bax wrote:Check the source code of the "connector" example provided with SFS2X?
Thank you. I think something is wrong.

I was trying to trace isConnected in the next line after sfs.connect and it always returns false (I thought there was something wrong with my server config because of this).

But if add the trace to isConnected inside the onConnection Event (checking for evt.params.success) it returns true.

It's already connecting but the answer is: why the isConnected property is still returning false right after executing connect?

Many thanks!
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

In the docs:
http://docs2x.smartfoxserver.com
there is an entire section dedicated to getting started with SFS2X which, lo and behold, is called "Getting Started" ;)

Next move to the "Development Basics" section and in no time you'll be an SFS2X jedi :)
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

delavega wrote:It's already connecting but the answer is: why the isConnected property is still returning false right after executing connect?
When you execute the sfs.connect() method on the client, a message is sent to the server, the server processes it and send a response. This of course takes some time (due to the network lag). If you check the isConnected flag right after sending the connect command, the client hasn't received the server response yet, so it is not yet aware if the connection was successful.
Paolo Bax
The SmartFoxServer Team
delavega
Posts: 12
Joined: 25 Feb 2011, 19:32

Post by delavega »

bax wrote:
delavega wrote:It's already connecting but the answer is: why the isConnected property is still returning false right after executing connect?
When you execute the sfs.connect() method on the client, a message is sent to the server, the server processes it and send a response. This of course takes some time (due to the network lag). If you check the isConnected flag right after sending the connect command, the client hasn't received the server response yet, so it is not yet aware if the connection was successful.
Thank you!
Post Reply