help with getAvatarMovieClipById

Post here your questions about the OpenSpace 1.x or notify bugs and suggestions.

Moderators: Lapo, Bax

jms
Posts: 3
Joined: 21 Jan 2009, 00:40

help with getAvatarMovieClipById

Postby jms » 23 Feb 2009, 17:40

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
User avatar
Bax
Site Admin
Posts: 4395
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 24 Feb 2009, 07:31

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).
Paolo Bax
The SmartFoxServer Team
falcan
Posts: 43
Joined: 04 Mar 2009, 12:55

doesn't work:(

Postby falcan » 17 Jun 2009, 11:52

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.
User avatar
Bax
Site Admin
Posts: 4395
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 17 Jun 2009, 12:05

This is not available in the trial version of OpenSpace, as it was added after its release.
Paolo Bax
The SmartFoxServer Team
falcan
Posts: 43
Joined: 04 Mar 2009, 12:55

Postby falcan » 17 Jun 2009, 13:38

Ah ok, we are on our way to buy it in the next few days so I'm looking forward to that function :-)
fabianres@live.com.mx
Posts: 40
Joined: 14 Apr 2010, 17:40

I´m having a similar problem...

Postby fabianres@live.com.mx » 15 May 2011, 20:04

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
User avatar
Bax
Site Admin
Posts: 4395
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 16 May 2011, 11:50

It seems you are using an older version of OpenSpace 1. You should download it again and update your project.
Paolo Bax
The SmartFoxServer Team
fabianres@live.com.mx
Posts: 40
Joined: 14 Apr 2010, 17:40

Postby fabianres@live.com.mx » 16 May 2011, 19:17

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?
User avatar
Bax
Site Admin
Posts: 4395
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 17 May 2011, 07:43

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
Paolo Bax
The SmartFoxServer Team
fabianres@live.com.mx
Posts: 40
Joined: 14 Apr 2010, 17:40

Postby fabianres@live.com.mx » 17 May 2011, 14:45

Alright, got it. Thanks

Return to “OpenSpace v1 discussions and help”

Who is online

Users browsing this forum: No registered users and 1 guest