快速了解滚动条来源的方法?
每当我在 mxml 组件(包括许多状态)中使用大量嵌套以及相当多的 Vbox 和其他容器时,当我看到屏幕上出现滚动条时,我总是感到困惑,尤其是其中包含数据网格(我总是想显示滚动条)在 datagrid 中而不是在父容器上,为此我通常在运行时将 datagrid 的高度和宽度设置为小于其父容器)。
我的问题是,使用调试器,我怎么可能(快速)知道哪个组件是我在屏幕上看到的滚动条的来源(如果有多个组件,那么当我向上滚动它时,组件的某些属性必须改变)或向下)。
谢谢。
Whenever I use a lot of nesting inside mxml components(including many states) with quite a few Vboxs and Other containers, I always get confused when I see a scrollbar appearing on screen, especially with datagrid inside it(I always want to show scroll bar in datagrid and not on the parent container, for which I usually set the height and width of datagrid smaller than its parent container at run time).
My question is, how could I possibly know (QUICKLY), using debugger, that which component is the source of scroll bar that I see on screen (if there are more than one, then some propoerty of compnent must change when I scroll it up or down).
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我意识到这个答案没有直接使用调试器。我的意思是,它确实是一个简单工具的想法。
我快速组合了一个简单的应用程序,其功能是报告哪个显示对象正在调度鼠标滚轮事件。是否有滚动条对应用程序来说并不重要,但我想您可以根据您的需要进行调整。它确实是一个快速启动,这是代码...
这里重要的是要看到您可以在顶层拾取鼠标滚轮事件,因为它默认情况下会冒泡,并且不可取消。
http://help.adobe .com/en_US/FlashPlatform/reference/actionscript/3/flash/display/InteractiveObject.html#event:mouseWheel
一旦你掌握了该事件,你就得到了 选项。
这是使用 Flex SDK 3.6 版本构建的,但构建 4.x 版本不需要太多时间。我只是显示目标显示对象的“toString()”值,但这可以是您想要的任何属性。您可能需要为添加事件的循环以及事件处理程序添加一些错误处理。正如我所说,这只是一个开始,我希望它能有所帮助。
I realise that this answer isn't using the debugger directly. I mean it as an idea for a simple tool really.
I had a quick go at putting together a simple app that's function is to report what display object is dispatching a mouse wheel event. It does not matter to the app if there is a scrollbar or not, but I guess you could adjust it to your needs. Its a quick start really, here's the code...
The important thing here really is to see that you can pick up the mouse wheel event at the top level, because it bubbles by default, and isn't cancelable.
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/InteractiveObject.html#event:mouseWheel
Once you've got hold of that event, you've got options.
This was built using version 3.6 of the Flex SDK, but it wouldn't take much to build a 4.x version. I am simply displaying "toString()" value of the target display object, but that could be any attribute you want. You'll probably want to put in some error handling for the loop adding events, and also in the event handler. As I said, its just a start, and I hope it helps.