Page 1 of 1

Avatar hitArea definition

Posted: 09 Nov 2009, 12:12
by FrankiD
My Avatar skins consist of a sequence of png´s which are 350 x 350 pix. The actual avatar graphic is centered in these png´s and measure about 100 x 100 pix. in the ‘walk’ and the ‘stand’ action. So there is a relatively large amount of transparent area around it. The reason for this is that I need other actions as well. During these actions the avatar graphic will measure up to 350 x 350 pix. (this way the png production will be easier).

The problem:

1. I need to be able to use mouseEvents, but as it is now OS react to the whole png, which it should´nt do. I need to be able to define a hitArea that only is in the center of the avatar. So that it do not register any mouseEvents when I mouseOver the transparent piece of the png.
2. Also I can not go to (register clicks on) any of the tiles in the area around the avatar, which is a serious problem. (Especially when there a 20 users on the map).

I have tried moving all the skin MovieClips into a movieClip container which I have set mouseEnabled and mouseChildren to false on, with no result. I have tried setting mouseEnabled and mouseChildren to false at the MainAvatar class as well (no result).

I have also tried setting all the avatar Related mouse options to ‘0’ in the Open Space
Config xml (result).

Please help

Thx

Posted: 11 Nov 2009, 09:21
by FrankiD
I´ve masked the MovieClip that contains the avatar pngs. It helps of course, but it is just not good enough. Anyone?

How does OS handle/set/register the hitArea on the Avatar. Should the graphics be converted to vector to achive what i want?

Posted: 12 Nov 2009, 10:06
by Bax
Our suggestion is to remove the transparent pixels from the PNGs.
Check this article: http://kb2.adobe.com/cps/128/tn_12804.html

Posted: 16 Nov 2009, 07:53
by FrankiD
bax wrote:Our suggestion is to remove the transparent pixels from the PNGs.
Check this article: http://kb2.adobe.com/cps/128/tn_12804.html
Okay. As I understand it, it means that we need to do the ‘break apart’-sequence on every single PNG? The thing is, we have like 100.000 images in a lot of swfs, and we need to update these swfs frequently. Therefore we have not got the time to do a lot of stuff in Flash with a single image. Could there be an easier way (Using code to do the hard work or something like that, change the way the pngs are rendered)?

Posted: 16 Nov 2009, 08:07
by Bax
Unfortunately this is the only way you can do it. Not sure if the same can be done via ActionScript.