Опция a) Использование (например, если цвета не генерируются динамически):
<s:states>
<s:State name="stateA" />
<s:State name="stateB" />
</s:states>
<!-- somewhere else in your code -->
<s:Rect id="bgFill" top="0" right="0" left="0" bottom="0">
<s:fill>
<s:SolidColor color.stateA="#313131" color.stateB="#f4dede" />
</s:fill>
</s:Rect>
<!-- somewhere else in your code -->
<fx:Script>
<![CDATA[
if(data.Bld_Type == "Office")
{
this.currentState = "stateA"
//***swatchCOL="red";
}
else if(data.Bld_Type == "Office/Warehouse")
{
this.currentState = "stateB"
//***swatchCOL="blue";
}
]]>
</fx:Script>
Опция b) Использование AS3:
var fillColor:SolidColor;
if(data.Bld_Type == "Office")
{
fillColor = new SolidColor(0xYOUR_HEX_COLOR);
bgFill.fill = fillColor;
}
else if(data.Bld_Type == "Office/Warehouse")
{
fillColor = new SolidColor(0xYOUR_OTHER_HEX_COLOR);
bgFill.fill = fillColor;
}
<s:Group left="10" right="10" top="10" bottom="10">
<s:Rect id="bgFill" width="25" height="25">
<s:stroke>
<s:SolidColorStroke color="green" weight="2"/>
</s:stroke>
<s:fill>
<s:SolidColor color="#ffffff"/> <!-- #ffffff is an example of a default color -->
</s:fill>
</s:Rect>
</s:Group>