Reputation: 145
I am working on a project with a pie containing for example 8 pieces. The pie is a MovieClip and every piece is a MovieClip as well. So a circle with 8 pieces.
pie_mc.piece1_mc.addEventListener(MouseEvent.CLICK, fadeout);
pie_mc.piece2_mc.addEventListener(MouseEvent.CLICK, fadeout);
pie_mc.piece3_mc.addEventListener(MouseEvent.CLICK, fadeout);
pie_mc.piece4_mc.addEventListener(MouseEvent.CLICK, fadeout);
pie_mc.piece5_mc.addEventListener(MouseEvent.CLICK, fadeout);
pie_mc.piece6_mc.addEventListener(MouseEvent.CLICK, fadeout);
pie_mc.piece7_mc.addEventListener(MouseEvent.CLICK, fadeout);
pie_mc.piece8_mc.addEventListener(MouseEvent.CLICK, fadeout);
What happens is that when I click on piece1_mc
, some of the area of the bitmap image is overlapping piece1_mc
and then this piece is fading instead of piece1_mc
.
Upvotes: 2
Views: 123
Reputation: 52193
Bitmaps hit area are always the full rectangle regardless of transparent areas. Probably the easiest way to solve this is to set the hitArea
of each MovieClip to a pie shape:
pieShape
.hitArea = pieShape
in the MovieClip. This will make the pie shape the area that the mouse interacts with.Upvotes: 1