Flex (FB 4.5) 按钮上的多行标签?
我正在尝试在 Flash Builder 4.5 中制作一个多行按钮(特定换行符,两者均左对齐),第二行为斜体。我可以通过制作一个按钮并在其顶部放置一个标签来做到这一点,但它会破坏该标签所在的按钮功能。
是否有一个简单的功能可以做到这一点,或者它是否开始进入自定义皮肤? (我已经看过了,但我对 FB 还很陌生,而且看起来学习曲线很陡峭)
I'm trying to make a button in Flash Builder 4.5 that is multi-lined (specific line break, both are left justified), with the second line being italicized. I can do this by making a button, and throwing a label on top of it, but it wrecks the button functionality where that label sits.
Is there an easy functionality to do this, or is it starting to step into custom skins? (I've looked at it, but I'm pretty new to FB, and it looks like a steep learning curve)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
是的,您肯定想要剥皮。这相当简单,因为它会为您生成所有代码。您只需找到按钮的标签并根据您的意愿进行修改即可。
很遗憾地说,但这是正确执行此操作的唯一方法。如果你想做的只是将其拼凑在一起,我认为你不应该接触代码......
Yeah, you definitely want skinning. It's fairly easy since it generates all the code for you. You just need to find the label for the button and modify it to your will.
Sorry to say, but this is the only way to do it properly. If what you're trying to do is just hack it together, I don't think you should be touching code...
小的澄清/补充:
虽然在按钮标签中包含多行就像将皮肤中“labelDisplay”的“maxDisplayedLines”属性设置为大于“1”的值一样简单,但 s:Label 不支持多种样式;即你不能让一行为常规而第二行为斜体。
FT任务
Minor clarification/addition:
While having multiple lines in the button label is as easy as setting the 'maxDisplayedLines' attribute of the 'labelDisplay' in the skin to anything larger than '1', s:Label does NOT support multiple styles; i.e. you can't have one line regular and the second line italic.
FTQuest
要创建按钮的多行标签:
一旦你填充了按钮的标签属性,它就会自动为你多行显示
To create a multi-lined Label of a Button:
Once you populate the label property of the Button, it'll auto multi-line for you
我没有发现任何东西可以做我想做的事情(我确实找到了 Flexlib 和 canvasButton,但它似乎对我不起作用)
我最终做的是制作自己的“模拟”按钮。一个带有两行标签的容器(一个正常,一个斜体,就像我想要的那样),上面有另一个容器。 mouseOver、mouseOut 和 click 都绑定到顶部容器,使其看起来像一个大按钮。 (我还使用了一些 alpha 透明度来模拟突出显示。
对于好奇的人(或其他有类似问题的初学者)-这就是我所做的
There was nothing I've found to do what I wanted to do (I did find Flexlib and canvasButton, but it didn't seem to work for me)
What I ended up doing is making my own "simulated" buttons. A container with 2 lines of labels (one normal, one italic, like I wanted) with another container over it. mouseOver and mouseOut and click were all bound to the top container to make it seem like one large button. (I also used some alpha transparency to simulate highlighting.
For the curious (or other beginners with similar issue) -this is what I've done