AS3:扩展默认ScrollBar组件

发布于 2024-09-07 07:18:07 字数 580 浏览 6 评论 0原文

我想调整 Flash ComboBox 内部显示的默认 ScrollBar 的宽度。从我对各种论坛的研究来看,最好的方法似乎是子类化 fl.controls.ScrollBar,我在这里尝试这样做:

package helpers {

  import fl.controls.ScrollBar;

  public class CustomScroller extends fl.controls.ScrollBar {

    public function CustomScroller() {
      super();
      trace("custom scroller in full effect!");
      width = 40;
    }  
  }
}

然后,在我的库中,我拍摄了出现在的“ScrollBar”影片剪辑初始创建 ComboBox 并将基类更改为“helpers.CustomScroller”。我在舞台上有三个 ComboBox 实例;但是,除了默认宽度之外,它们都没有显示任何内容,我也没有看到构造函数中 trace() 语句的输出。

知道为什么这不起作用吗?感谢您的考虑。

I'd like to adjust the width of the default ScrollBar that appears inside of a Flash ComboBox. From my research on various forums, it seems like the best approach would be to subclass fl.controls.ScrollBar, which I've tried doing here:

package helpers {

  import fl.controls.ScrollBar;

  public class CustomScroller extends fl.controls.ScrollBar {

    public function CustomScroller() {
      super();
      trace("custom scroller in full effect!");
      width = 40;
    }  
  }
}

Then, in my library, I've taken the "ScrollBar" movie clip that appears upon initial creation of a ComboBox and changed the base class to "helpers.CustomScroller". I've got three ComboBox instances on the stage; however, none of them are showing anything but the default width, nor am I seeing the output from the trace() statement in my constructor.

Any idea why this isn't working? Thanks for your consideration.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

画离情绘悲伤 2024-09-14 07:18:07

我只需要这样做一次,不想再这样做了。基本上,为了完成此任务,我需要创建一个名为 fl.controls.WideScrollBar 的 fl.controls.ScrollBar 副本。您还需要修改 fl.containers.BaseScrollPane 和 fl.containers.ScrollPane。

在 WideScrollBar 中,我覆盖了 public static const WIDTH:Number

在 WideBaseScrollPane 中,您需要将 _verticalScrollBar 和/或 _horizo​​ntalScrollBar 的类更改为 WideScrollBar。然后在我的 WideScrollPane 中,我覆盖了构造函数中对 setStyle 的调用,以指向我的自定义类实例以进行换肤。

I have only had to do this once, and don't want to do it any more. Basically, to accomplish this, I needed to create a copy of fl.controls.ScrollBar called fl.controls.WideScrollBar. You also need to modify fl.containers.BaseScrollPane and fl.containers.ScrollPane.

In WideScrollBar I overrode public static const WIDTH:Number

In WideBaseScrollPane you need to change the class of _verticalScrollBar and/or _horizontalScrollBar to be WideScrollBar. Then in my WideScrollPane, I overrode the calls to setStyle in the contructor to point to my custom class instances for skinning.

不喜欢何必死缠烂打 2024-09-14 07:18:07

将滚动窗格作为子级添加到 Sprite,然后缩放该父级 Sprite。滚动条将相应调整。如果 ScrollPane 的源现在太大,则按相同比例因子的倒数进行缩放。

Add the scroll pane as a child to a Sprite, then scale that parent sprite. Scroll bars will adjust accordingly. If source of ScrollPane is now too big, scale by inverse of same scale factor.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文