skin click through an avatar

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

Moderators: Lapo, Bax

ffourcad
Posts: 130
Joined: 25 Feb 2010, 10:26

skin click through an avatar

Postby ffourcad » 06 Apr 2010, 14:47

Hello,

i have a problem (one more) : I made a skin clickable, but when an avatar is above the skin, I can't click on the skin. Is there a way to do it ?

EDIT : I tried to make mouseEnabled = false on every avatar (I thought that the "EnableAvatarMouseEvents" parameter in the openspace_client.xml was doing it), but it made no difference.
ffourcad
Posts: 130
Joined: 25 Feb 2010, 10:26

Postby ffourcad » 07 Apr 2010, 08:43

in some case, when I click on the skin, and an avatar is above it, I get the following error :

Code: Select all

TypeError: Error #1009: Il est impossible d'accéder à la propriété ou à la méthode d'une référence d'objet nul.
   at com.smartfoxserver.openspace.shared.control.map::MapManager/getTileInstanceData()
   at com.smartfoxserver.openspace.shared.control.input::MouseController/setTileStatus()
   at com.smartfoxserver.openspace.shared.control.input::MouseController/mouseInteractionHandler()


EDIT : This problem only occurs when I add the "mouseEnabled = false" on the avatar.
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 07 Apr 2010, 19:06

First of all you shouldn't set the mouseEnabled property on the avatar on your own (in fact you can break the OpenSpace behavior).
If your avatar is above the point of the skin you are trying to click, there,s no way you can do this. Only transparent parts of the avatar allows the click-through, supposed you deleted the transparent pixels in Flash.
Paolo Bax
The SmartFoxServer Team
ffourcad
Posts: 130
Joined: 25 Feb 2010, 10:26

Postby ffourcad » 08 Apr 2010, 07:36

Since the avatar is basically a movieClip, we should be able to click through it by setting its mouseEnabled attribute to false. And I can't see why I couldn't do it.
ffourcad
Posts: 130
Joined: 25 Feb 2010, 10:26

Postby ffourcad » 08 Apr 2010, 13:33

I tried to find a solution to the issue above : I've added a click listener on the stage, and, using the getObjectsUnderPoint method, I manage to find the tile on which I click. The problem is that when I click on an avatar the event is not fired. Even if I use the capture phase and a high priority in the addEventListener. I don't know what you do with the avatars but there really is something weird about it.

EDIT : I add that I'm using the default avatar (the one from the examples).

EDIT (again) : I've found the problem : in order for the Click Event to be fired, the mouse_down and mouse_up have to be on the same object. But since my avatars are constantly moving, it doesn't happen. The solution is just to listen the Mouse_up event instead of click event. :D
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 12 Apr 2010, 16:56

Actually I have to make a correction to what I said previously:
bax wrote:First of all you shouldn't set the mouseEnabled property on the avatar on your own (in fact you can break the OpenSpace behavior).

What is important is not the mouseEnabled property, but the mouseChildren: when an avatar is created, OpenSpace sets it mouseChildren property to false. Changing this value breaks the OpenSpace behavior.
Paolo Bax
The SmartFoxServer Team
DeLo
Posts: 5
Joined: 09 Mar 2011, 13:29
Location: Lithuania

Re: skin click through an avatar

Postby DeLo » 28 Feb 2012, 12:49

I've run into a similar problem.
We use ghost avatar for displaying chat balloons and character names.
However, we need other people to be able to click through it - imagine, while one avatar talks, chat balloon goes over the door. Same problem for very long names - they block content behind them.

I have set mouseEnabled = false in GhostAvatar class, but it has no effect - skin roll over and click events are not dispatched when avatars try to enter blocked door.
What can you suggest?
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: skin click through an avatar

Postby Bax » 29 Feb 2012, 10:46

Did you try setting the <EnableBringGhostToFront> parameter in the OpenSpace client configuration to false?
I'm not sure it will work, but give it a try.
Paolo Bax
The SmartFoxServer Team

Return to “OpenSpace v2 discussions and help”

Who is online

Users browsing this forum: No registered users and 16 guests