2012-04-18 36 views
0

几乎所有Flex组件都具有mouseOver/mouseOut或rollOver/rollOut事件。要求这些事件不是鼠标光标,而是另一个元素,比如Image或Bitmap。使用hitTest代替mouseOver/mouseOut

例如,上面有一个Colomn图表和图像动画,当图像在列上时,我需要获取数据(colomn值或索引)。如果它是一个组件,那么我会使用hitTest。但如果是图表怎么办?

+0

在列的图像?是吧?您应该查看events.http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/charts/ColumnChart.html#eventSummary – 2012-04-18 17:50:00

+0

我知道所需的事件不是。我需要图像对图表组件以及鼠标的反应。 – Astraport 2012-04-18 19:41:24

+0

对不起,我只是不明白你对图像说什么 – 2012-04-18 19:58:50

回答

0

难道你不能告诉图像/位图不是mouseEnabled?

+0

你是什么意思mouseEnabled?图像独立于鼠标的移动而移动。 – Astraport 2012-04-19 10:08:24

+0

好的,但你可以说'imageSprite.mouseEnabled = false'来防止图像精灵对鼠标敏感。 – Tino 2012-05-13 20:55:38

0

我不能正确理解你的问题沉绵我尝试这个...

如果您在图表上添加mouselisteners,每当事件是派遣检查..

position.x = event.currentTarget.mouseX; 
position.y = event.currentTarget.mouseY; 

那么你就可以尝试使用hitTest。

if(obj.hitTestPoint(position.x,position.y)){ 

} 

,这可能是工作....