如何将复选框或其他内容放入滚动窗格中?

发布于 2024-11-06 11:43:46 字数 155 浏览 0 评论 0原文

我如何将按钮或复选框放在滚动窗格中以便它滚动。 我尝试将它们添加为子项,但它们似乎附加到滚动窗格而不是内部。他们不滚动,只是延伸出来?

除了文本之外,有没有办法将内容放入滚动窗格中。我试图解决的问题是处理小区域内的大量复选框。复选框是从脚本动态生成的。

谢谢, 担

How would I put buttons or checkboxes in a scroll pane so it will scroll.
I tried adding them as children but they seem to be attached to the scrollpane but not inside. they do not scroll they just extend out of it?

Is there a way to put content in a scrollpane besides text. The problem I'm trying to solve is dealing with a large number of checkboxes in a small area. The checkboxes are dynamically generated from the script.

Thanks,
Dan

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

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

发布评论

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

评论(1

凉风有信 2024-11-13 11:43:46

如果您谈论的是标准滚动窗格,那么它应该有一个 .source 属性。如果您添加复选框的名称,它将进入滚动窗格。

现在,如果您想添加复杂的内容,我建议您创建一个空的影片剪辑并将其放入滚动窗格中。您想要添加到滚动窗格的任何内容,请将其添加到此影片剪辑中。

//create your container
var mc:MovieClip = new MovieClip();
//you don't need to add it to the displaylist (addChild(mc))

//now set it as the source of your scrollpane
your_scrollpane.source = mc;

//any time you add a new item
mc.addChild(your_checkbox);

//you can set the properties
your_checkbox.x = 0;
your_checkbox.y = 0;

//and refresh the scrollpane
your_scrollpane.update();

您还可以在将 mc 设置为滚动窗格的源之前对其进行设置。

希望这有帮助。

If you are talking about a standard scrollpane, then it should have a .source property. If you add the name of your checkbox, it will get into the scrollpane.

Now, if you want to add complex content, I suggest you to create an empty movieclip and put that into the scrollpane. Anything you want to add to the scrollpane, add it to this movieclip.

//create your container
var mc:MovieClip = new MovieClip();
//you don't need to add it to the displaylist (addChild(mc))

//now set it as the source of your scrollpane
your_scrollpane.source = mc;

//any time you add a new item
mc.addChild(your_checkbox);

//you can set the properties
your_checkbox.x = 0;
your_checkbox.y = 0;

//and refresh the scrollpane
your_scrollpane.update();

You can also setup your mc before making it as the source of your scrollpane.

Hope this helps.

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