用 OS Native Scrollbar 替换 ScrollPane Scrollbar [英] Replacing ScrollPane Scrollbar with OS Native Scrollbar

查看:30
本文介绍了用 OS Native Scrollbar 替换 ScrollPane Scrollbar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种简单的方法可以用操作系统的本机滚动条替换 ScrollPane 滚动条?

Is there an easy way to replace the ScrollPane scrollbar with the OS's native scrollbar?

如果 Flash 应用程序具有与用户操作系统相同的外观,那么它们看起来会更加集成——这并不总是很容易检测(Vista Aero 还是 Classic?).

Flash applications look much more integrated if they have the same skinning as the user's operating system -- which isn't always easy to detect (Vista Aero vs. Classic?).

你们有没有遇到过这样做的 Flash 应用程序的例子?

Have you guys come across any examples of Flash apps doing this?

推荐答案

出于好奇,我们将滚动窗格组件分成一个独立的 swf,并在小部件的右侧和底部放置了一组两个嵌套的 div.

For the curious, we separated the scrollpane component into a self-contained swf and placed a set of two nested divs along the right and bottom side of the widget.

以垂直滚动条为例,外层div被设置为滚动条的高度,并且有一个hidden的CSSoverflow-x,还有一个auto 的 >overflow-y.然后将子 div 设置为某个任意宽度,高度等于滚动窗格内容的高度(以 px 为单位).

Using the vertical scrollbar as an example, the outer div was set to the height of the scrollpane and had a CSS overflow-x of hidden, and an overflow-y of auto. The child div was then set to some arbitrary width and a height equal to the height in px of the scrollpane's content.

浏览器将显示适当大小的滚动条",我们可以快速读取外部 div 上的垂直滚动偏移量,以了解 Flash 滚动窗格的偏移量.水平滚动条使用了相同的技术,并进行了适当的修改.

The browser would display an appropriately sized "scroll grip" and we could quickly read the vertical scroll offset on the outer div to know how far to offset the Flash scrollpane. The same technique, with appropriate modifications, was used for the horizontal scrollbar.

我们还包含了一些逻辑来根据容器的溢出自动隐藏容器.结果非常接近本机操作系统的行为.

We also included some logic to auto-hide the containers based on their overflow. The result matched native OS behavior pretty closely.

虽然这听起来像是一个巨大的黑客,但我们能够广泛部署解决方案 (scribd.com) 没有任何重大问题.

While this may sound like a huge hack, we were able to widely deploy the solution (scribd.com) without any major issues.

这篇关于用 OS Native Scrollbar 替换 ScrollPane Scrollbar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆