Degrafa换色器

时间:2008-12-25 13:42:31

标签: flex degrafa

<degrafa:LinearGradientFill id="bluedream">
    <degrafa:GradientStop color="#6ab5d0"/>
    <degrafa:GradientStop color="#388aae"/>
</degrafa:LinearGradientFill>

<degrafa:GeometryComposition graphicsTarget="{[bgCanvas]}">
    <degrafa:RoundedRectangle id="color_preset" fill="{bluedream}"/>
</degrafa:GeometryComposition>

我遇到了使用degrafa代码的问题,我已经为color_preset.fill定义了一组不同的渐变,当用户在组合框中选择不同的颜色时,它会动态变化。

我将fill="{bluedream}"替换为fill="using_variable"并导致错误编译邮件:“填充”的初始化程序:类型com.degrafa.core.IGraphicsFill的值无法用文本表示。

是否有使用此代码作为换色器的解决方案?

1 个答案:

答案 0 :(得分:0)

示例中的fill属性指向ID为“bluedream”的LinearGradientFill。您可以使用不同的渐变(或实体或其他填充)替换填充或更改渐变填充本身的颜色:

<degrafa:LinearGradientFill id="bluedream">
    <degrafa:GradientStop color="{your_combobox.selectedItem}"/>
    <degrafa:GradientStop color="{your_other_combobox.selectedItem}"/>
</degrafa:LinearGradientFill>

<degrafa:GeometryComposition graphicsTarget="{[bgCanvas]}">
     <degrafa:RoundedRectangle id="color_preset" fill="{bluedream}"/>
</degrafa:GeometryComposition>

我没有运行该代码,但应该可以运行。我们的想法是使用下拉列表的selectedItem更改GradientStop的颜色(假设这是一个字符串)。 此示例执行的操作非常相似,但使用颜色选择器而不是下拉列表: http://degrafa.org/source/CS4IconPreviewer/CS4IconPreviewer.html

相关问题