为什么使用 s:Line 而不是 mx:HRule?

发布于 2024-11-09 13:42:48 字数 297 浏览 5 评论 0原文

使用 mx:HRulemx: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 技术交流群。

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

发布评论

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

评论(3

七禾 2024-11-16 13:42:48

因为 mx 组件正在被淘汰,取而代之的是更好的、可换肤的 Spark 组件。为什么不能对 Line 使用 width=100% ?顺便说一句,该线段不会显示任何内容,因为您没有笔画集。这就是我认为你想要的:

<s:Line width="100%">
   <s:stroke>
      <s:SolidColorStroke color="#000000" weight="1" caps="square"/>
   </s:stroke>
</s:Line>

如果你真的只想让它只是一个标签,你总是可以创建一个新组件,将其命名为 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:

<s:Line width="100%">
   <s:stroke>
      <s:SolidColorStroke color="#000000" weight="1" caps="square"/>
   </s:stroke>
</s:Line>

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.

御弟哥哥 2024-11-16 13:42:48

好吧,你不会想写那样的东西......

我可能会写得更像这样......

<s:Line width="100%">
            <s:stroke>
                <s:SolidColorStroke caps="none" color="#AF0000" joints="miter" miterLimit="4"
                                    weight="2"/>
            </s:stroke>
            <s:filters>
                <s:BevelFilter angle="45.0" blurX="1" blurY="1" distance="1"
                               highlightAlpha="1.0" highlightColor="#FFFFFF" knockout="false"
                               quality="2" shadowAlpha="1.0" shadowColor="#000000" strength="1"
                               type="inner"/>
            </s:filters>
</s:Line>

但这真的取决于你。任何火花形状基元都可以使用相对定位和大小调整来编写。

编辑

贾克斯比我先一步:)

Well you wouldn't want to write stuff like that...

I would probably write it more like this..

<s:Line width="100%">
            <s:stroke>
                <s:SolidColorStroke caps="none" color="#AF0000" joints="miter" miterLimit="4"
                                    weight="2"/>
            </s:stroke>
            <s:filters>
                <s:BevelFilter angle="45.0" blurX="1" blurY="1" distance="1"
                               highlightAlpha="1.0" highlightColor="#FFFFFF" knockout="false"
                               quality="2" shadowAlpha="1.0" shadowColor="#000000" strength="1"
                               type="inner"/>
            </s:filters>
</s:Line>

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 :)

瀞厅☆埖开 2024-11-16 13:42:48

我在使用 S:Line 元素时遇到了一个错误,它没有 100% 填充我的皮肤内部。
我将其替换为 S:SkinableContainer 元素,如下所示:

<s:SkinnableContainer backgroundColor="Lime" width="100%" height="10"/>

我发现这对我来说是一个很好的解决方案,并且它还节省了代码中的空间,就像您提到的那样。

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:

<s:SkinnableContainer backgroundColor="Lime" width="100%" height="10"/>

I found it is a good solution for me, and it also saves space in the code like you mentioned you'd like.

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