ItemRenderer
いくつかのフラグを持つデータがあります。これらのフラグに応じて ItemRenderer の色を変更する必要があります。どうすればそれを達成できますか?これは私の IR です。
<?xml version="1.0" encoding="utf-8"?>
<s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
autoDrawBackground="false"
x="{data.x}" y="{data.y}">
<s:states>
<s:State name="node"/>
<s:State name="nodeIn"/>
<s:State name="nodeOut"/>
<s:State name="nodeTrafficLight"/>
<s:State name="nodeIntersection"/>
<s:State name="nodeBlocked"/>
</s:states>
<s:Ellipse width="16" height="16" x="-8" y="-8">
<s:stroke>
<s:SolidColorStroke weight="2"
color="#FFFF00"
color.nodeTrafficLight="#FF00FF"
color.nodeIntersection="#FF9900"
color.nodeBlocked="#000000"
color.nodeIn="#00FF00"
color.nodeOut="#FF0000"/>
</s:stroke>
<s:fill>
<s:SolidColor alpha=".5"
color="#FFFF00"
color.nodeTrafficLight="#FF00FF"
color.nodeIntersection="#FF9900"
color.nodeBlocked="#000000"
color.nodeIn="#00FF00"
color.nodeOut="#FF0000"/>
</s:fill>
</s:Ellipse>
<fx:Script>
<![CDATA[
override protected function getCurrentRendererState():String
{
if (data.isBlocked)
return "nodeBlocked";
if (data.isIn)
return "nodeIn";
if (data.isOut)
return "nodeOut";
if (data.isIntersection)
return "nodeIntersection";
return "node";
}
]]>
</fx:Script>
</s:ItemRenderer>
data.isIn
しかし、これらのフラグの一部 (例: ) が変更されたときに、これらの状態が更新されません。私のモデルには[Bindable]
タグがあります。