Please support us by disabling ad blocker for smarttutorials.net ...

Two dimensional array in Smartfoxserver 2x (Java API)

Posted by & filed under Action Script 3, Java, SmartFox Server.

This is simple example how to use two dimensional array in SmartFoxServer actionScript 3 API as well Java API. I am using actionScript 3 API on the client, on the server side I’m using Java API to get that value the client sent.

two dimensional array in smartfoxserver 2x

Two Dimensional Array in SmartFoxServer 2x

Here is client side two dimensional array………..

var gameScore:ISFSObject= new SFSObject();

var score:ISFSArray = new SFSArray();
score.addIntArray([1,1]);
score.addIntArray([2,2]);
score.addIntArray([3,3]);

gameScore.putSFSArray(“score”,score);
sfs.send(new ExtensionRequest(‘getGameScores’, gameScore));

Here is the server side Java code. We are sending two dimensional SFSArray to server, While getting the two dimensional SFSArray on the server side we need to convert that SFSArray into array collections then into normal array. You will get an idea while go through the below java code…………

ISFSArray score= params.getSFSArray("score");
for(int i=0; i<score.size();i++)
{
	Collection e= score.getIntArray(i);
	Object[] b= e.toArray();
	int questionId= (Integer) b[0];
	int languageId = (Integer) b[1];
}

 

 

 

 .

Download Premium Only Scripts & 80+ Demo scripts Instantly at just 1.95 USD per month + 10% discount to all Exclusive Scripts

If you want any of my script need to be customized according to your business requirement,

Please feel free to contact me [at] muni[at]smarttutorials.net

Note: But it will be charged based on your customization requirement

Get Updates, Scripts & Other Useful Resources to your Email

Join 10,000+ Happy Subscribers on feedburner. Click to Subscribe (We don't send spam)
Every Email Subsciber could have access to download 100+ demo scripts & all future scripts.

Get Instant Script Download Access!