Flex 捕获线鼠标事件
我有一个 BorderContainer,其中包含一些 Spark Line 实例。我需要通过单击此来选择此行。但是添加事件鼠标单击侦听器失败。 ASdoc(http://docs.huihoo.com/flex/4/spark/primitives/Line.html)表示该线路只有激活和停用事件。请建议检测线路是否点击的最佳方法(使用另一个线路类?)。我认为捕获 bordercontainer 中的点击是一个糟糕的解决方案。
I have a BorderContainer with some instances of spark Line. I need to select this lines by clicking on this. But adding event mouse click listener fails. ASdoc (http://docs.huihoo.com/flex/4/spark/primitives/Line.html) says that line have only activate and deactivate events. Please suggest best way to detect whether line clicked(use another line class?). I think that catching of clicks in the bordercontainer is bad solution.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试使用 Line 的
要订阅的 displayObject
属性。Try to use Line's
displayObject
property to subscribe.我更喜欢问这样一个问题:这是什么样的?在很多方面,您都在描述一个按钮。您可以单击的东西...可能是您希望表明可以单击的东西,等等。
该行为在
Button
中为您提供,因此我会考虑对Button 进行换肤
与您的行并使用这些皮肤按钮填充您的BorderContainer
。它将为您提供通过状态进行鼠标悬停的功能(因此您可以向用户指示该行是可单击的),并且如果需要,它将使您可以轻松地为该行添加更大的点击区域。I prefer to ask the question: what does this act like? In many ways, you are describing a button. Something you can click on... probably something you would like to indicate that it can be clicked on, etc.
The behavior is there for you in
Button
, so I would consider skinning theButton
with your line and populating yourBorderContainer
with these skinned buttons. It would give you mouse-over abilities via states (so you can indicate to your user that the line is clickable) and it will allow you to easily add a larger hit area for the line if you need it.