真是些費時的事. 今天又被玩了.在flex 3下的一些經驗變成了負擔.
之前在Flex 3下 ,如使用itemRenderer時大都如下寫法:
<mx:List ..>
<mx:ItemRenderer>
<mx:component>
<mx:HBox../>
</mx:component>
</mx:ItemRenderer>
但如今在flash builer 4時使用Sparks才發覺,他把他視為skin了.在DESIGN頁時可自CSS編修加入.
會以<s:ItemRenderer> 來建一新檔案.
而在這個檔案內要小心哦.
如使用Array時可以用ArrayCollection,ArrayList,不要用Array型態給 dataProvider屬性,不然會像我一樣.查了半天才查出來.
例如:
[Bindable]
public var operationOpertors:Array = new Array("AND","OR");
<s:ComboBox dataProvider="{operationOpertors}" />
一直出現錯誤:
TypeError: Error #1034: Type Coercion failed: cannot convert []@f844309 to mx.collections.IList.
at mx.binding::Binding/defaultDestFunc()[E:\dev\4.x\frameworks\projects\framework\src\mx\binding\Binding.as:270]
at Function/http://adobe.com/AS3/2006/builtin::call()
at mx.binding::Binding/innerExecute()[E:\dev\4.x\frameworks\projects\framework\src\mx\binding\Binding.as:475]
at Function/http://adobe.com/AS3/2006/builtin::apply()
.....
Must use ArrayCollection or ArrayList,like this:
[Bindable]
public var operationOpertors:ArrayCollection = new ArrayCollection(["AND","OR"]);