Asv3's Blog

November 5, 2009

Issue with HitArea in Canvas hitArea

Filed under: flex — Tags: , , , , , , , , , , — asv3 @ 6:29 am

I happen to generate a graph in Flex, I needed node element to store data, and have some graphics inside that, without second thought I extended Canvas component for GraphNode.

In flex when you use Canvas to draw some thing behind origin or point (0,0)  hitArea of that Canvas happens to behave strangely. I could figure out this problem by giving background colors to this Canvas. You can resolve it in 2 ways,

1. Use a UIComponent for inside a Canvas and set hitArea of that Canvas to it’s child UIComponent

2. Use Container instead of Canvas. If you don’t want given component to respond to updateDisplayList you can safely extend from Container (mx.core.Container)

PS: To have all your graphics behind (0,0) visible, you should have clipContent set to false.

Blog at WordPress.com.