Another client problem

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

Post Reply
Dr_Malito
Posts: 18
Joined: 13 Dec 2006, 20:52
Location: Chile
Contact:

Another client problem

Post by Dr_Malito »

I have this:

Code: Select all

function onUserVariablesUpdate(userObj:User, changedVars:Array)
{
	trace("onUserVariablesUpdate:" + userObj + ", changed vars: " + changedVars)
		
	var variables:Object = userObj.getVariables()
	var px:Number = variables["ypos"]
	var py:Number = variables["ypos"]
	
	trace("User: " + userObj.getName() + " is now located at " + px + ", " + py)
}
And get this.
[Received]: <msg t="sys"><body action="uVarsUpdate" r="7"><vars><var n="xpos" t="n">3879</var><var n="ypos" t="n">3296</var></vars><user id="5" /></body></msg>
onUserVariablesUpdate:undefined, changed vars: xpos,ypos
User: undefined is now located at undefined, undefined
seems that the smartfox client is receiving the vars, but they are not been legible or associable to the object.

any idea?
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

Sorry which API version are you using? AS 2 or AS 3?

In order to trace the API version:

Code: Select all

trace(sfs.getVersion())
where sfs is your SmartFoxClient instance
Lapo
--
gotoAndPlay()
...addicted to flash games
Dr_Malito
Posts: 18
Joined: 13 Dec 2006, 20:52
Location: Chile
Contact:

Post by Dr_Malito »

it's 1.3.7

I'm using AS 2.0

The SmartFox Client is in a external class "SFClient"

Code: Select all

import it.gotoandplay.smartfoxserver.*

class SFClient
{

private var smartfox:SmartFoxClient;
private var ip:String;
private var port:Number;
private var zone:String;

 function SFClient()
 {
  this.ip	 = "127.0.0.1";
  this.port = 9339;
  this.zone = "mw";
  this.extensionName = "mwlogin";
		
  this.smartfox = new SmartFoxClient();
  this.smartfox.debug = true;
  
  this.smartfox.onConnection = this.handleConnection;
  this.smartfox.connect(ip, port);

.....more code
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

You are probably trying to set the variables before you have populated the roomList. Without that data the client API won't be able to identify the user who set the variables.

Check your code and additionally see our examples for further reference (The avatar chat, for example)
Lapo
--
gotoAndPlay()
...addicted to flash games
Dr_Malito
Posts: 18
Joined: 13 Dec 2006, 20:52
Location: Chile
Contact:

Post by Dr_Malito »

Thanks lapo!

problem resolved :D
Post Reply