之间的区别和graphics.lineTo()
如果我为按钮设置外观并使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
发生这种情况的原因可能是 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.
因为 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.