Page 1 of 1

help with getAvatarMovieClipById

Posted: 23 Feb 2009, 17:40
by jms
Would it be possible for you to give me a code example of using getAvatarMovieClipById listed in the documentation.

I know how to get the userID from smartFox.

What I want to do is in some rooms the users shrink 1/2 size. But when a new user enters they are seen full size. I have set a param in smartFox for the user ' size: ' and I can pull that when the avatar enters the room. But what I can't do if target that avatar and set the siz for my avatars view to be correct.

jms

Posted: 24 Feb 2009, 07:31
by Bax
The usage of that (undocumented) method is straightforward: you pass the user id and it returns a MovieClip corresponding to your avatar class (you will probably have to cast it).

doesn't work:(

Posted: 17 Jun 2009, 11:52
by falcan
When trying to use this method, I'm getting

1061: Call to a possibly undefined method getAvatarMovieClipById through a reference with static type com.smartfoxserver.openspace:OpenSpace.

I need this method for several things, mainly to tell my custom avatar class some extra stuff...so I need to get movieClip of each avatar created.

Posted: 17 Jun 2009, 12:05
by Bax
This is not available in the trial version of OpenSpace, as it was added after its release.

Posted: 17 Jun 2009, 13:38
by falcan
Ah ok, we are on our way to buy it in the next few days so I'm looking forward to that function :-)

I´m having a similar problem...

Posted: 15 May 2011, 20:04
by fabianres@live.com.mx
I´m trying to use the os.getAvatarById method in my application whenever I click on any avatar so I can access that avatar movieclip:

function onAvatarClicked(evt:AvatarEvent):void
{
trace("--[OpenSpace] Avatar clicked (user id: " + evt.params.id + "; avatar name: " + evt.params.avatarMovieClip.avatarName + ")")

var demoAvatar:DummyAvatarMovieClip = os.getAvatarById(evt.params.id) as DummyAvatarMovieClip


}

but the compiler throws the following error:

1061: Call to a possibly undefined method getAvatarById through a
reference with static type com.smartfoxserver.openspace:OpenSpace.

which is identical to what the poster above had.

I do have the openspace 1 licence, so what gives?

Am I missing a class here?

Fabian Enders

Posted: 16 May 2011, 11:50
by Bax
It seems you are using an older version of OpenSpace 1. You should download it again and update your project.

Posted: 16 May 2011, 19:17
by fabianres@live.com.mx
Well, that´s odd. I bought the OS1 licence two months ago, could it be possible that the version I have is old enough, given that its just two months old?

Posted: 17 May 2011, 07:43
by Bax
Sorry, I didn't notice it before, but you are using the wrong method name: it's getAvatarMovieClipById, not getAvatarById.
Also, there's no need you use that method in your code, because the event params already contain a reference to the avatar movieclip (and you already use it): evt.params.avatarMovieClip

Posted: 17 May 2011, 14:45
by fabianres@live.com.mx
Alright, got it. Thanks