I've been trying to get my avatarMC to show up on stage and it just won't, I have all the variables setup for movement. But I don't know how to spawn it to the stage, I've scoured the docs, if I've missed something please do tell. In case you need to see the code in which I used to setup all the userVariables here ya' go:
Code: Select all
if (!sfs.mySelf.containsVariable(this.USERVAR_X) && !sfs.mySelf.containsVariable(this.USERVAR_Y))
{
var px:int = Math.round(Math.random() * this.Town.avArea.width)
var py:int = Math.round(Math.random() * this.Town.avArea.height)
var dir:String = this.AVATAR_DIRECTIONS[2]
setAvatarVariables(px, py, dir)
}
function setAvatarVariables(px:int, py:int, dir:String):void
{
var userVars:Array = [];
userVars.push(new SFSUserVariable(this.USERVAR_X, px));
userVars.push(new SFSUserVariable(this.USERVAR_Y, py));
userVars.push(new SFSUserVariable(this.USERVAR_DIR, dir));
sfs.send(new SetUserVariablesRequest(userVars));
}
function onUserVarsUpdate(evt:SFSEvent):void
{
var changedVars:Array = evt.params.changedVars as Array;
var user;this.User = evt.params.user as this.User;
// Check if the user changed his position
if (changedVars.indexOf(this.USERVAR_X) != -1 || changedVars.indexOf(this.USERVAR_Y) != -1)
{
// Check if avatar exists
if (this.getAvatar(user.id) != null)
{
// Move the user avatar
this.moveAvatar(user)
}
else
{
// Create the user avatar
this.createAvatar(user, true)
}
}
}