Page 1 of 1

skin click through an avatar

Posted: 06 Apr 2010, 14:47
by ffourcad
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.

Posted: 07 Apr 2010, 08:43
by ffourcad
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.

Posted: 07 Apr 2010, 19:06
by Bax
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.

Posted: 08 Apr 2010, 07:36
by ffourcad
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.

Posted: 08 Apr 2010, 13:33
by ffourcad
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

Posted: 12 Apr 2010, 16:56
by Bax
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.

Re: skin click through an avatar

Posted: 28 Feb 2012, 12:49
by DeLo
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?

Re: skin click through an avatar

Posted: 29 Feb 2012, 10:46
by Bax
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.