为什么使用 s:Line 而不是 mx:HRule?
使用 mx:HRule 或 mx:VRule 时,Flash Builder 建议改用 s:Line。 为什么我要写这样的东西:
<s:Line xFrom="0" xTo="245" yFrom="0" yTo="1"/>
而不是
<mx:Hrule width="100%" />
如何获得相对大小? (百分比)
When using a mx:HRule or mx:VRule, Flash Builder suggests using a s:Line instead.
Why would I want to write stuff like this :
<s:Line xFrom="0" xTo="245" yFrom="0" yTo="1"/>
instead of
<mx:Hrule width="100%" />
How do I get relative sizes ? (percent)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
因为 mx 组件正在被淘汰,取而代之的是更好的、可换肤的 Spark 组件。为什么不能对 Line 使用 width=100% ?顺便说一句,该线段不会显示任何内容,因为您没有笔画集。这就是我认为你想要的:
如果你真的只想让它只是一个标签,你总是可以创建一个新组件,将其命名为
HRule
并为其设置默认样式。Because mx components are being phased out for the better, skinnable Spark components. And why can't you use width=100% with Line? Btw, that line segment won't show anything because you don't have a stroke set. Here's what I think you want:
If you really just want to make it just one tag, you could always create a new component, call it
HRule
and have a default style to it.好吧,你不会想写那样的东西......
我可能会写得更像这样......
但这真的取决于你。任何火花形状基元都可以使用相对定位和大小调整来编写。
编辑
贾克斯比我先一步:)
Well you wouldn't want to write stuff like that...
I would probably write it more like this..
But it's really up to you. Any of the spark shape primitives can be written using relative positioning and sizing.
edit
Jax beat me to it :)
我在使用 S:Line 元素时遇到了一个错误,它没有 100% 填充我的皮肤内部。
我将其替换为 S:SkinableContainer 元素,如下所示:
我发现这对我来说是一个很好的解决方案,并且它还节省了代码中的空间,就像您提到的那样。
I had kind of a bug using the S:Line element, it didn't fill the 100% inside my skin.
I replaced it with an S:SkinableContainer element like this:
I found it is a good solution for me, and it also saves space in the code like you mentioned you'd like.