限制MouseEvents Flex中的皮肤掩盖? [英] Restrict MouseEvents to Mask in Flex Skin?
问题描述
我有一个ButtonSkin(Flex 4中的皮肤)与矩形,一个标签和一个组,该组屏蔽矩形。在翻滚,我动画标签的x为 this.width
,并在部署,回到原来的位置。问题是,当我部署,如果我摇到右边(其中标签躲在面具后面),它没有登记部署,直到我走过去的标签(this.width * 2)。我如何prevent这一点,所以当我推出的可视区域,尽管我仍然在面具背后的标签,我得到一个部署事件?
这里的皮肤:
`
`
`
`
`
`
`
`
`
`
`
`
`
`
要做到这一点,最简单的方法是创建一个打的对象是坐在你的皮肤按钮在显示器的顶部。您创建的打的对象你想要的鼠标是互动与和附加的事件侦听器的打的对象精确的尺寸。
在弯曲柔性4您可以使用< S:组>
,而不必担心透明度或能见度
I have a ButtonSkin (Flex 4 Skin) with a Rect, a Label, and a Group, the Group masking the Rect. On rollOver, I animate the Label's x to this.width
, and on rollOut, back to the original position. The problem is, when I rollOut, if I roll to the right (where the label is hiding behind the mask), it doesn't register rollOut, until I go past the label (this.width * 2). How do I prevent that, so when I rollOut of the visible area, even though I'm still over the label behind the mask, I get a "rollOut" event?
Here's the Skin:
`
`
`
`
`
`
`
`
`
`
`
`
`
`
The easiest way to do this is to create a "hit" object that sits on the top of the display in your button skin. You create the "hit" object to the exact dimensions you want the mouse to be interactive with and attach the event listeners to the "hit" object.
In flex flex 4 you can use <s:Group>
and not have to worry about transparency or visibility.
这篇关于限制MouseEvents Flex中的皮肤掩盖?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!