Hi,
I want to make my avatar wave at other users on clicking a wave button, So I am doing this by changing its state to wave. But the when my avatar waves at others only i can see the waving and it is not being broadcasted to the other clients on the room. So the coding part i am using is simple and as follows...,
var avatarState:Object = {};
avatarState.id = "wave";
var myAvatar:Avatar = openSpace.getMyAvatar();
myAvatar.state = avatarState;
// Change state
openSpace.setMyAvatarState(avatarState);
please help...
How to broadcast effects of setMyAvatarState to other client
Re: How to broadcast effects of setMyAvatarState to other cl
You don't need to assign the state manually like you do with these lines of code:
The following method call (setMyAvatarState) will do it for you and broadcast the change to the other clients.
Please notice that this will work only if you override the state property on the avatar class. Check the setMyAvatarState documentation.
Code: Select all
var myAvatar:Avatar = openSpace.getMyAvatar();
myAvatar.state = avatarState;
The following method call (setMyAvatarState) will do it for you and broadcast the change to the other clients.
Please notice that this will work only if you override the state property on the avatar class. Check the setMyAvatarState documentation.
Paolo Bax
The SmartFoxServer Team
The SmartFoxServer Team
Re: How to broadcast effects of setMyAvatarState to other cl
Thanks a lot Bax got it solved,
Got one more problem i.e when i am changing avatar state the set state function is called twice!!!??
Here's my getter and setters,
override public function get state():Object
{
return _state;
}
override public function set state(data:Object):void
{
_state = data;
if(_state!=null)
if(_state.id == "wave")
{
trace("wave"); //tracing twice???
wave= true;
drawAvatar();
}
}
And as you suggested myStateChange function is,
// Crete action object
var avatarState:Object = {};
avatarState.id = "wave";
// Change state
openSpace.setMyAvatarState(avatarState);
thanks again...
Got one more problem i.e when i am changing avatar state the set state function is called twice!!!??
Here's my getter and setters,
override public function get state():Object
{
return _state;
}
override public function set state(data:Object):void
{
_state = data;
if(_state!=null)
if(_state.id == "wave")
{
trace("wave"); //tracing twice???
wave= true;
drawAvatar();
}
}
And as you suggested myStateChange function is,
// Crete action object
var avatarState:Object = {};
avatarState.id = "wave";
// Change state
openSpace.setMyAvatarState(avatarState);
thanks again...
Re: How to broadcast effects of setMyAvatarState to other cl
That might be called twice due to the state UserVariable update event being received back.
Nothing to worry about.
Nothing to worry about.
Paolo Bax
The SmartFoxServer Team
The SmartFoxServer Team
Re: How to broadcast effects of setMyAvatarState to other cl
Thanks Bax,
But the thing I am worried about is the wave animation is happening twice... which I don't really want!!!
Any solutions???
But the thing I am worried about is the wave animation is happening twice... which I don't really want!!!
Any solutions???
Re: How to broadcast effects of setMyAvatarState to other cl
hai...
I am back here with some queries,
When i used setMyAvatarAction for avatar to perform wave action it worked perfectly fine without any issues....
So my question is will there be any issue later!? I am really confused regarding which function to use for avatar to make wave action either setMyAvatarState or setMyAvatarAction!!!!
Please guide....
I am back here with some queries,
When i used setMyAvatarAction for avatar to perform wave action it worked perfectly fine without any issues....
So my question is will there be any issue later!? I am really confused regarding which function to use for avatar to make wave action either setMyAvatarState or setMyAvatarAction!!!!
Please guide....
Re: How to broadcast effects of setMyAvatarState to other cl
Both setMyAvatarAction and setMyAvatarState work in the same way.
The first one is intended for those actions which last a limited amount of time. For example in my opinion waving is an action, because the user clicks a button, the avatar waves for a couple of seconds and the stops.
The state should be something different, its change always controlled by the user: for example making the avatar sit on a chair. When the avatar is seated, its state is changed. Then the user clicks again and the avatar stands up, changing its state.
Hope this helps.
The first one is intended for those actions which last a limited amount of time. For example in my opinion waving is an action, because the user clicks a button, the avatar waves for a couple of seconds and the stops.
The state should be something different, its change always controlled by the user: for example making the avatar sit on a chair. When the avatar is seated, its state is changed. Then the user clicks again and the avatar stands up, changing its state.
Hope this helps.
Paolo Bax
The SmartFoxServer Team
The SmartFoxServer Team
Re: How to broadcast effects of setMyAvatarState to other cl
This info was a lot useful for me....
Thanks a lot Bax for your support...
Thanks a lot Bax for your support...
Return to “OpenSpace v2 discussions and help”
Who is online
Users browsing this forum: No registered users and 13 guests