Flex:具有 VBOX 类型(平滑)滚动的列表?
我有一个使用自定义 itemRenderer 和自定义 itemEditor 的列表控件。 itemRenderer/Editor 是文本区域控件,每个控件至少包含 3 行文本。
列表控件的默认滚动性质是按项目滚动,而不是像 VBOX 那样按一定数量的像素滚动。
我希望我的列表控件具有更多的文字处理器外观,向下滚动将一次滚动一行文本。由于每个列表项至少包含 3 行文本,因此向下滚动会跳过所有三行文本,并将下一个列表项放置在列表控件的顶部。
有什么建议吗?
我试图弄清楚如何编写一个可以像列表一样运行的自定义 VBOX,但我对 Flex 很陌生——而且我只编程了一年。 ....不太确定从哪里开始。
谢谢!
I have a list control that uses a custom itemRenderer and custom itemEditor. The itemRenderer/Editor are textarea controls with at least 3 lines of text each.
The default scrolling nature of a list control is by Item, rather than by some number of pixels, the way a VBOX scrolls.
I want my list control to have more of a word-processor look, where scrolling down will scroll one line of text at a time. Because each list item holds at least 3 lines of text, scrolling down skips all three and positions the next list item at the top of the list control.
Any suggesitons?
I was trying to figure out how to write a custom VBOX that could act like a list, but I'm new to flex -- and I've only been programming for a year. ....Not really sure where to start.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
使用 Flex 4 中的 Spark List 控件(测试版可用)。它的“Scroller”界面更加灵活。
Use the Spark List control from Flex 4 (the beta is available). Its "Scroller" interface is much more flexible.
关于在我们的应用程序中使用 FLEX 4 组件的评论,尚未得到答复。
但是,我推断,如果我的要求是一个包含大量控件的大列表,则不可能有一个具有可变行高的平滑滚动列表。
由于列表控件不会立即实例化其所有项目,因此它无法根据所有控件的总高度确定所需的最小和最大滚动值。它只能根据其包含的控件数量来确定这些值。真糟糕:-(
Haven't gotten an answer to my comment, regarding the use of a FLex 4 component in our app.
However, I have deduced that it isn't possible to have a smooth-scrolling List with variable row height, if my requirements are a large list with lots of controls.
Because the list control does not instantiate all of its items at once, it can't determine the needed min and max scroll values based on the total height of all controls. It can only determine these values from the NUMBER of controls it contains. Bummer :-(
我在使用带有文本和拇指的项目渲染器时遇到了类似的问题。通过使列表在显示之前呈现其所有项目、将列表包装在滚动条和组内以及关闭列表本身内部的滚动来解决此问题。确保您没有指定列表高度 - 让 flex 来做到这一点。
我的代码:(由于某种原因,我必须将滚动条放在一个组中才能使其工作)
I had a similar issue using an item renderer with text and a thumb. Solved it by making the list render ALL of its items before display, wrapping the list inside a scroller and a group, and turning off scrolling inside the list itself. Make sure you don't specify the list height - let flex do that.
My code: (for some reason I had to enclose the scroller in a group for it to work)