开发者

Is it possible to use conditional operator in checkbox using flex?

开发者 https://www.devze.com 2022-12-09 04:37 出处:网络
I want to fill color based on condition so I used conditional operator for the checkbox. But it\'s shows the error Implicit coercion of a value of type String to an unrelated type Array. What did I do

I want to fill color based on condition so I used conditional operator for the checkbox. But it's shows the error Implicit coercion of a value of type String to an unrelated type Array. What did I do wrong ? How can I dynamically change the color of a checkbox ?

开发者_StackOverflow中文版
<mx:CheckBox id="home" enabled="false"  fillColors="{(data.actualwin != '1') ? 
    '[#8CE912,#8CE912]' : '[#8CE912,#8CE912]'}"  selected="{data.betting_home=='1'}"/>


Try replacing

'[#8CE912,#8CE912]'

with

["#8CE912","#8CE912"]

or

[0x8CE912,0x8CE912]

(remove quotes)

You pass a string ('[#8CE912,#8CE912]') into a property where an array is expected


Or you can use an ItemRenderer

0

精彩评论

暂无评论...
验证码 换一张
取 消