之间的区别和graphics.lineTo()

发布于 2024-09-25 13:55:38 字数 150 浏览 1 评论 0原文

如果我为按钮设置外观并使用 AS3 Graphice.clear() 、graphics.lineTo 和 beginFill 创建形状,则该按钮会与容器中的其他项目重叠。

当我使用 和 mxml 创建相同的形状时,按钮整齐地定位在容器内。

这是为什么?

If I skin a button and use the AS3 graphice.clear() and graphics.lineTo and beginFill to create a shape, the button overlaps other items in the container.

When I use the and mxml to create the same shape, the button is neatly positioned inside the container.

Why is that?

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

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

发布评论

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

评论(2

寄风 2024-10-02 13:55:38

发生这种情况的原因可能是 Flex 无法计算动态绘制按钮的大小,而 MXML 版本允许在显示之前计算大小。您可能需要重写测量方法来计算宽度/高度。如果这不是问题,请发布一些代码,以便我们仔细查看。希望有帮助。

This is probably happening because Flex is unable to calculate the size of your dynamically drawn button, while the MXML version allows the size to be calculated prior to being displayed. You may need to override the measure method to calculate the width/height. If that's not the issue, then post some code so we can take a closer look. Hope that helps.

滥情空心 2024-10-02 13:55:38

因为 Line 对象正在执行大量检查和额外工作,而您在使用 Graphics 对象时则不需要执行这些检查和额外工作。查看spark.primitives.Line 的代码,看看它做了哪些你没有做的事情。

Because the Line Object is doing a bunch of checks and extra work you aren't doing when you use the Graphics object. Look at the code for spark.primitives.Line to see what its doing that you aren't.

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