Posts Tagged ‘SmartFoxServer’

Working with Open Space V 1.0

December 7th, 2010 by aabhaanjan

Working with Open Space V 1.0

Design Section:

As we know isometric projection depends upon the view angle. We need to follow the design pattern based on tile.  First we will design a tile and decide the size (height and width) here I am defining it 122X61.

Lets design an isometric tile :

Step :  a). Draw a rectangular shape.


Step: b) Rotate the shape in 45 degree angle


Step: c) Select height 50 percent

OpenSpace_tile_height_50_percent copy

step: d) Set the linkage :


Skins Swf : we will need to design a skin swf where all skins for the tiles and object will be designed. In below given image I am designing a skin for the Tile . The important point need to remember while designing we have to give it a linkage in the library as shown in the picture given below.


Combination of Tiles : For complex objects which are bigger than the one size we need to develop it using combination of tiles . As given image I have put 4 Tiles in the isometric view and guided (because we only need it as the base for design).


Over these guided tiles we will design the base (if needed). As shown in the below given image.

Over the base we will design the object for example I have tried to design an object.

Last point what we need to remember that we will have to give it a proper linkage name.

BackGround Swf : we will need to design a background swf where all where specially we will design the backgrounds as shown in the image I have used example graphics for the background of OpenSpace. The important point need to remember while designing we have to give it a linkage in the library ..

Development and Deployment in the OpenSpace Editor :

Now we need to deploy these in the OpenSpace Editor. For now I have installed trial version of OpenSpace. Go to Start ànd OpenSpace Trial OpenSpace Editor Trial and click it.

After clicking the OpenSpace Trial you will get a window like this. Where I am putting some values for the required fields for example :


New  project : Select “New project ” if you want to create a new OpenSpace .

Following are details of this screen . There are two parts :


Project details :

Title : Here I am putting the name of project “TestIso”.

Folder : Here we will set the directory path of the project.

Skins SWF : Here path of the  swf will come which is containing Skins.

Backgrounds SWF : Here path of that swf will come which is containing Backgrounds.

Auto generate skins : by checking this field we allow the editor automatically generate the skins.

Avatar mockup scale : by dragging  it we can decide the avatar’s size.

Tile properties :

Here we decide the Tile’s properties .

Tile Size : Here we decide the Tile Size.

Tile ratio : Here we define  the ratio between the height and width of the tile. Show tile elevation : Show the tiles elevation

On clicking create :

On clicking create we will get assets in the library of Skins as shown in this image.


It has all the assets what we had designed in the Skin Fla. Now we can to create the New Skin to set the different properties on it


In Tile Editor : Create and edit the tile according to your requirement using

Proerties panel. For this example I have created a tile and skinned it with the tile skin also selected “walkable ”value true because I want the player should walk on this.

Similarly we will need to create the tile for every object.


In SuperTile Editor :

In this section using the tiles we can create the super tiles.

In Background Editor :

Similarly in the background section we will create the background using the existing backgrounds assets.


In Map Editor :

Create the new map and add the object on the grid. As example I have added here.


Now using export the map we need to export the map for world use.It will generate the map in xml format.


For Updating Skins Library :

Create the object in the Skins fla and generate the swf. In Skin Editor section of OpenSpace create new skin and add the class it will get updated.

Lets move to the second part where we will import the XML and link it with SmartFoxServer 🙂

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Advanced Chat Application-Part 2

November 9th, 2010 by aabhaanjan

lets move to the few additional functions where we are going to create new room , join Selected room etc ..


private function handleSmartFoxEvents():void {

smartFoxObject.addEventListener(SFSEvent.onExtensionResponse, onExtensionResponse);
smartFoxObject.addEventListener(SFSEvent.onRoomListUpdate, onRoomListUpdate);
smartFoxObject.addEventListener(SFSEvent.onJoinRoom, onJoinRoom);
smartFoxObject.addEventListener(SFSEvent.onJoinRoomError, onJoinRoomError);
smartFoxObject.addEventListener(SFSEvent.onUserCountChange, onUserCountChange);
smartFoxObject.addEventListener(SFSEvent.onUserEnterRoom, onUserEnterRoom);
smartFoxObject.addEventListener(SFSEvent.onUserLeaveRoom, onUserLeaveRoom);
smartFoxObject.addEventListener(SFSEvent.onPublicMessage, onPublicMessage);
smartFoxObject.addEventListener(SFSEvent.onPrivateMessage, onPrivateMessage);

smartFoxObject.addEventListener(SFSEvent.onRoomAdded, onRoomAdded)
smartFoxObject.addEventListener(SFSEvent.onRoomDeleted, onRoomDeleted)
smartFoxObject.addEventListener(SFSEvent.onCreateRoomError, onCreateRoomError)

smartFoxObject.addEventListener(SFSEvent.onLogout, onLogout)


as above mentioned we have added three additional sfs events where on room creation , deletion and on any room creation error dispatched the functions .. now lets discuss the code bit more ..


public function onRoomAdded(evt:SFSEvent):void {

var room:Room =
chatWindow_mc.roomList.addItem( {label:room.getName(),data: room.getId() });

public function onRoomDeleted(evt:SFSEvent):void {

public function onCreateRoomError(evt:SFSEvent):void {
trace(“error “+evt.params.error);


onRoomAdded : we need to update the room list and add the current room.

onRoomDeleted:we need to update the room list and delete the current room.

onCreateRoomError: here we will be able to see the error if on creation of room we will get any error.

Now how we are going to create the new room ? 🙂


private function btnNewRoom_click(evt:MouseEvent):void {
chatWindow_mc.createRoomWindow_mc.visible = true

private function handleCreateRoom(evt:MouseEvent):void {
chatWindow_mc.createRoomWindow_mc.visible = false
var roomName:String = chatWindow_mc.createRoomWindow_mc.room_name.text

if (roomName.length > 0)

var roomObj:Object = {} = roomName




for that we are going to use above mentioned function. Now to join a specific room :


private function JoinSelectedRoom(evt:ListEvent):void {

if(chatWindow_mc.roomList.selectedItem != null){
var roomId:int = int(


So now our advanced chat is almost completed .. why almost ? 🙂 becuase there are many more actions  which can be included in advanced chat

for example adding password protected room, defining the max number of user , making buddy etc… 🙂

Tags: , , , , , , , , , , , , , , , , ,

Simple Chat Application:Part- 5

October 30th, 2010 by aabhaanjan

In handleSmartFoxEvents() function we have called  following functions

//Here we are going to handle all the smartfoxEvents  for now here I am showing  6 function later

We will need to add more.


private function handleSmartFoxEvents():void{

smartFoxObject.addEventListener (SFSEvent.onExtensionResponse, onExtensionResponse);

smartFoxObject.addEventListener(SFSEvent.onRoomListUpdate, onRoomListUpdate)

smartFoxObject.addEventListener(SFSEvent.onUserCountChange, onUserCountChange)

smartFoxObject.addEventListener(SFSEvent.onJoinRoom, onJoinRoom)

smartFoxObject.addEventListener(SFSEvent.onJoinRoomError, onJoinRoomError)

smartFoxObject.addEventListener(SFSEvent.onPublicMessage, onPublicMessage)

smartFoxObject.addEventListener(SFSEvent.onPrivateMessage, onPrivateMessage)

smartFoxObject.addEventListener(SFSEvent.onUserEnterRoom, onUserEnterRoom)

smartFoxObject.addEventListener(SFSEvent.onUserLeaveRoom, onUserLeaveRoom)

smartFoxObject.addEventListener(SFSEvent.onLogout, onLogout)



Now lets discuss it in detail :

onExtensionResponse() : this  will give us all server responses defined in the server side. Dispatched when a command/response from a server-side extension is received.

onRoomListUpdate(): this event  is dispatched when the list of rooms of  the current zone is received.
If the default login mechanism provided by SmartFoxServer is used, then this event is dispatched right after a successful login.

onUserCountChange(): this event is dispatched when the number of users and/or spectators changes in a room of the current zone. This event allows to keep track in real-time of the status of all the zone rooms in terms of users and spectators. If any user joins or leave the room it gets updated automatically.

onJoinRoom (): this event is dispatched when a user joins any room  successfully

onJoinRoomError(): while joining a room any error occurs, this event is dispatched. This error could happen, for example, if the user is trying to join a room which is currently full  it will throw an error.In our application we would like to trace the error  so we will get using evt.params.error

onPublicMessage(): this event is dispatched when a user  want to send a public message for all the users.

onPrivateMessage ():this event is dispatched when a user  want to send a public message for all the users.

onUserEnterRoom(): this event is dispatched when another user joins the current room.

onUserLeaveRoom(): this event is dispatched  when a user leaves the current room. This  event is also dispatched when a user gets disconnected from the server.

onLogout (): Dispatched when the user logs out successfully. After a successful logout the user is still connected to the server, but he/she has to login again into a zone, in order to be able to interact with the server. When a user will want to logout from the screen he will need to click on the logout button. On clicking log out button this function will be called.

Tags: , , , , , , , , , , , , , , , ,