Flex 3 TileList 所选项目的奇怪行为
我有一个 Flex TileList 和我制作的 itemRenderer。
该列表完美地加载内容并呈现它。 渲染器是一个简单的画布元素,带有一个复选框和另一个带有一些带有数据标签的画布。 我实现了一种方法,在 TileList itemClick="clickedItemHandler(event)"
上更改复选框的状态(如果选中 -> 取消选中,反之亦然)。
问题是:如果我单击该项目的任何位置(复选框除外),该方法就会起作用。当我单击复选框时,它不会改变状态。
我的想法:也许我正在更改复选框的状态,并且事件将其更改回来,但我对其进行了调试,但它看起来并非如此..
I have a Flex TileList with an itemRenderer made by me.
The list loads the content perfectly and renders it.
Renderer is a simple canvas element with a checkbox and another canvas with some labels with data.
I implemented a method that, on TileList itemClick="clickedItemHandler(event)"
, changes the state of the checkbox (if checked -> uncheck, and vice versa).
Problem is: the method works if i click on any place of the item, EXCEPT the checkbox. When i click the checkbox, it doesn't change state.
My thoughts: maybe i was changing the state of the checkbox, and the event changing it back, but i debugged it and it doesn't look like so..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
解决方案实际上很简单。也许实现此目的的最佳方法是确保 CheckBox 忽略鼠标单击,这可以通过将“mouseEnabled”属性设置为 false 来完成。
干杯
The solution is actually quite simple. Perhaps the best way to make this work is making sure the CheckBox ignores mouse clicks, and this can be done by setting the "mouseEnabled" attribute to false.
Cheers
我想你可能是对的。单击该复选框时会进行切换,然后在事件到达
TileList
时将其切换回来。调试时您可能看不到这一点,具体取决于您的确认方式...您可以通过确认事件的target
不是CheckBox
来修复此问题。I think you're probably correct. The checkbox toggles when you click it and then you toggle it back when the event gets to the
TileList
. You may not see this when debugging depending on how you are confirming... you may be able to fix this by confirming that thetarget
of the event is not aCheckBox
.