chinese documentation
home overview products showcase shop support company


SmartFoxServer 1.4.2 -- Patch



What's new :
dividerThe new 1.4.2beta patch introduces a few new enhacements to the server side framework:

  • LoadVars:
    allows to load text data from a remote HTTP server, in the format of a query string.
    It's usage is identical to the LoadVars object in Flash.

    Usage example.

  • #include directive:
    You can now split your code into many different .as files and organize them in folders.
    We also added a new error-reporting system that should always indicate the correct line number and include file name where an error occurred.

  • Public Message internal event:
    A new event handler that can be used to catch public messages being sent in a Room or Zone.
    This allows to catch the messages in the server side extension and log them or store them in a history database etc...

    Usage example

Please report any problem or bug in our support forums


Requirements and installation:
divider

--> It is required that you already have installed SmartFoxServer PRO 1.4.0
--> Download and unzip the package
--> Copy the smartfoxserver.jar file in your Server/ folder
--> Copy the lib/mainLib.as file in your lib/ folder
--> Finally start the server.

 

LoadVars code example:
divider

/*
* SmartFoxServer PRO
* Test LoadVars
* v 1.1.0 beta
*
*/

function init()
{
   var _send = new LoadVars()
   var _load = new LoadVars()
   
   // Set parameters to send
   _send.name       = "Albert"
   _send.surname    = "Einstein"
   _send.job       = "genius"
   _send.location    = "Germany"
   
   // Handle the remote data
   _load.onLoad = function(success, errorMsg)
   {
      if (success)
      {
         trace("Data received:")
         
         trace("Name    : " + this.name)
         trace("Surname : " + this.surname)
         trace("Job     : " + this.job)
         trace("Location: " + this.location)
      }
      else
      {
         trace("Loadvar Failed. " + errorMsg)
      }
   }
   
   // Send data with POST method and receive it back in the _load object
   _send.sendAndLoad("http://www.smartfoxserver.com/temp/loadvars.php", _load, "post")
}


function destroy()
{
   trace("Bye bye!")
}


function handleRequest(cmd, params, user, fromRoom)
{
   //
}


function handleInternalEvent(evt)
{
   //
}

Public Message event handling:
divider

/**
* Extension intialization
* This example can be used as Zone level extension
*/
function init()
{
	/*
		enable "pubMsg" internal events
		by default this event is turned off
	*/
	var zone = _server.getCurrentZone()
	zone.setPubMsgInternalEvent(true)
}

/**
* Handle internal events
* 
* @param	e	the event object
*/
function handleInternalEvent(e)
{
	evtName = e.name
	
	if (evtName == "pubMsg")
	{
		sourcRoom = e.room		// the room object
		senderUser = e.user		// the sender user
		message = e.msg			// the public message
		
		// ... do something cool here ...
	}
}

Download
divider
Download SmartFoxServer PRO 1.4.2beta patch

Download SmartFoxServer Beta




 

| Homepage | Overview | Products | Services | Showcase | Support | Contacts | gotoAndPlay.it |
| SmartFoxBits | BlueBox | RedBox | Clustering| BattleFarm | OpenSpace |
(c) gotoAndPlay() 2004-2010 - All rights reserved. P.IVA 03121770048