arrays - ArrayCollection error in Flex does not accept single XML nodes - alternatives? -
i error when retrieve xml has 1 node (no repeating nodes) , try store in arraycollection. -when have more 1 "name" nodes...i not error.
typeerror: error #1034: type coercion failed: cannot convert "xxxxxx" mx.collections.arraycollection.
this error occurs line of code:
mylist= e.result.list.name;
why can't arraycollection work single node? i'm using arraycollection dataprovider component -is there alternative can use take both single , repeating nodes work dataprovider? in advance!
code:
[bindable] private var mylist:arraycollection= new arraycollection(); private function getlist(e:event):void{ var getstudyloungesservice:httpservice = new httpservice(); getstuffservice.url = "website.com/asdf.php"; getstuffservice.addeventlistener(resultevent.result, ongetlist); getstuffservice.send(); } private function ongetlist(e:resultevent):void{ mylist= e.result.list.name; }
the resultformat
should set e4x
:
var getstudyloungesservice:httpservice = new httpservice(); getstuffservice.url = "website.com/asdf.php"; getstuffservice.resultformat = "e4x"; getstuffservice.addeventlistener(resultevent.result, ongetlist); getstuffservice.send();
you can retrieve results follows:
new xmllistcollection(e.result.list.name);
(all credits amarghosh, been banging head on 1 hours, missed comment!)
Comments
Post a Comment