一个只有一个圆角和渐变背景的 VBox
我正在使用 Flex 3.4 SDK。
我正在尝试以编程方式(是的,必须是这种方式)设置 VBox 的样式/皮肤,使其右上角呈圆形,并获得两种颜色的渐变背景。
修改我发现的示例,我能够实现两种效果(角和背景),但只能单独实现:
VBox 并非全部圆角:http://livedocs.adobe.com/flex/3/html/help.html?content=skinning_6.html
具有渐变背景的 VBox: http://butterfliesandbugs.wordpress.com/2007 /06/08/generic-background-gradient-for-containers/
但我需要做的是同时应用两者。到目前为止,我所有的编码尝试都默默地失败了。
有人知道如何正确执行此操作吗?
I'm working with Flex 3.4 SDK.
I'm trying to programmatically(yep, must be this way) style/skin a VBox so that its top right corner is rounded, and it gets a two colors gradient brackground.
Modifying examples I found around I was able to accomplish both effects(corner and background) but only separately:
VBox with not all rounded corners: http://livedocs.adobe.com/flex/3/html/help.html?content=skinning_6.html
VBox with gradient background: http://butterfliesandbugs.wordpress.com/2007/06/08/generic-background-gradient-for-containers/
But what I need to do is to apply both at the same time. And all my coding attempts so far have failed silently.
Would anyone know how to go about doing this correctly?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我的博客上有一篇关于如何制作这个精确组件的帖子 这里。
您创建一个基本的自定义 MXML 组件(在本例中为 VBox 扩展)。您指定一个编程皮肤,这是应用斜角和渐变的地方。
程序化皮肤在 updateDisplayList 函数中完成所有绘制工作。
这是一些演示代码(其余部分在我的博客上,带有演示)
,请查看 这里。希望这有帮助。
I have a post on my blog on how to make this exact component Here.
You create a basic custom MXML component (extending in this case, VBox). You specify a programmatic skin, which is where the bevel and gradient gets applied.
The programmatic skin does all it's drawing in the updateDisplayList function.
Here is some of the code (the rest is on my blog, with a demo)
for a demo, look Here. Hope this helps.
按照第二个链接中的步骤操作,但您应该能够使用“drawRoundRectComplex”,而不是使用“drawRect”。不过,您可能需要尝试一些矩阵设置。我好像记得有一些问题。
另一种选择是使用 degrafa。可能有一点学习曲线,但它很强大并且可以做到这一点。
Follow the steps from your second link, but instead of using "drawRect", you should be able to use "drawRoundRectComplex". You may need to play around with some of the matrix settings though. I seem to remember having some problems.
Another option is to use degrafa. There can be a bit of a learning curve, but it's powerful and can do this.