I am new to flex and i am stuck with this problem.
I have a combobox with some custom objects added to it say of type xyz.When i try to get the array out of this combox using the following code
var Arr:Array = cmbItem.dataProvider.toArray();
the result returned is correct,but when i try to iterate over the array and get a element out it and try to assign it to "xyz" object it is returning null!!
var temp:XYZ = arr as XYZ;
temp is always null.
Any pointers appreciated.
1. try to typecast using canonical style, i.e. XYZ(arr)
2. you could typecast right inline your for loop statement
for each (var a:XYZ in Arr)
If you feel this message answers your question or helps, please mark it respectively :)
Thanks for taking time in responding..
It was my mistake,actually the dataprovider was populated directly from a query.So the Array had types as OBJECTS and i was trying to typecast to a custom object.Since the array was not holding type of XYZ it will never allow me to type cast it to XYZ?