希望簡單的問題:我試圖通過在CSS文件中設置一些值來設置數據網格上的alternatingItemColors,但似乎沒有任何工作。從CSS樣式設置alternatingItemColors的問題(Flex)
CSS文件看起來是這樣的:
.FACS0 {color: #B0B0B0;}
.SACS0 {color: #A6A6A6;}
.AICS0
{
alternatingItemColors: #B0B0B0, #A6A6A6;
}
我嘗試了各種不同的東西。首先,我想直接加載AICS0,即
dataGrid.setStyle("alternatingItemColors", "AICS0");
但是這會導致運行時錯誤
TypeError: Error #1034: Type Coercion failed: cannot convert "AICS0" to Array.
我又試圖
dataGrid.setStyle("alternatingItemColors", ["FACS0", "SACS0"]);
這運行正常,但所有行設置爲黑色。
注:此
dataGrid.setStyle("alternatingItemColors", [0xFF00CC, 0x112200]);
的作品就好了 - 可惜這不會爲我工作,即我需要能夠從一個CSS文件中加載數據。
謝謝!
Amarghosh - 這個編譯並運行良好,但沒有效果 - 我覺得很有意思。任何其他想法?謝謝你! – 2010-06-28 22:53:42
@fred嘗試設置'styleName' mxml本身,看看它是否有任何效果。你是否正確地包含了CSS? – Amarghosh 2010-06-29 04:09:01
好的,找到了這個bug。感謝您的建議。 – 2010-07-03 03:33:17