Custom Login : Flash CS4 (Action Script 3.0)

October 10th, 2010 by aabhaanjan

I would like to provide the tutorial using Flash and Flex both. The first I am starting with Flash CS4 using Action script 3.0.

Step 1 :  Server side :

C:\Program Files\SmartFoxServerPRO_1.6.6\Server

Open the Program Files folder inside that folder you will get SmartFoxServer’s   Server folder where we have to edit the config or create your own config. I am modifying the already created config according to my requirement.

1a

Step 2:  Add zone for the Custom login :

b

I have added a zone named “login” in the server side config where I am defining emptyNames as false value and customLogin will be on. As I need one room so I have created it “The Hall” where maximum number of users are  defined as 50 and it is a public room. For server side extension script I have named it login.

Step 3:  Server side Extension :

For “login.as” I would like to use the example extension given by SmartFoxServer for the server side.So Now our server side extension will look like this

c

dNow Start your server and it will add a new zone “login ”.

e

Step 4: Client Side

Lets create our first screen for establishing connection.

t

In the first layer of Fla I have created the connection status movie clip named connectionStatus_MC where I have taken a dynamic text box statusMsg_txt which will show status of connection with server. On load automatically we will send the connection request to the server.


f

So now we need a login Panel I have created this panel from where user can send login request to the server. There are two input boxes username_txt and pwd_txt for User name and Password. And butt_login to send the request to the server. Also a dynamic text box msg_txt for the message display.

So Now lets Start the Client Side Code.

customLogincustomLoginCode2customLoginCode3customLoginCode4