Error #1034 Type Coercion Failed Cannot Convert To Mx.collections.arraycollection
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Error #1034: cannot convert XMLList@c093fd1 to mx.collections.ArrayCollection up vote 0 down vote favorite protected function initView(event:ViewNavigatorEvent):void { // Api Call NFLScore.url="http://api.nfldata.apiphany.com/trial/XML/ScoresByWeek/2013REG/14" + "?key=BDAE4263-4522-45B9-96FF-01F0DFB0F610"; NFLScore.send(); } protected function NFLScore_resultHandler(event:ResultEvent):void { // Alle items en Labels value geven myData=event.result.ArrayOfScore.Score; } protected function NFLScore_faultHandler(event:FaultEvent):void { // TODO Auto-generated method stub printUit.text = "foute zoek opdracht"; } //////// End //////// ///////////////////////// API CALL ///////////////////////// ]]>
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow http://stackoverflow.com/questions/20786245/error-1034-cannot-convert-xmllistc093fd1-to-mx-collections-arraycollection Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Type Coercion failed: cannot convert http://stackoverflow.com/questions/14331106/type-coercion-failed-cannot-convert-xmllist106e9af1-to-mx-collections-ilist XMLList@106e9af1 to mx.collections.IList up vote 1 down vote favorite using code blew I am trying to parse the following soap response. here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About http://stackoverflow.com/questions/10777471/adobe-flex-cannot-convert-xmllist-to-mx-collections-ilist Us Learn more about Stack Overflow the company Business Learn more about hiring developers https://issues.apache.org/jira/browse/FLEX-25683 or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Adobe Flex: Cannot Convert XMLList to mx.collections.IList error #1034 up vote 1 down vote favorite My Flex app runs a service to a php page that pulls data from my database, then structures the result in an XML format. I created a new XMLList called testList outside of any functions, then when the results come back (they first come to flex as a single string holding all of the XML code) I have the following error #1034 type code to turn it into XML and then append to my testList: var s:String = event.result as String; var xml:XML = new XML(s); testList = xml.user; The data is used in one function, then it's also passed to a component of mine, where I try to display the XMLList in a List (with testList as dataProvider) and I get the following error: TypeError: Error #1034: Type Coercion failed: cannot convert XMLList@68ffa01 to mx.collections.IList. I have a feeling it's probably a noob error, but any help is appreciated. xml flex share|improve this question asked May 27 '12 at 21:38 user1077544 488 add a comment| 2 Answers 2 active oldest votes up vote 4 down vote accepted E4X expressions return lists of matching XML. xml.user gives you an XMLList of all user elements. You can use XMLListCollection, which implements IList, to wrap the result so you can use it as a dataprovider. var xml:XML = new XML(event.result as String); var list:IList = new XMLListCollection(xml.user); The other option is to loop though the XMLList and add it to an array or whatever collection you need. If you know for sure that there is only one user, you can do this inst Type Coercion failed: cannot convert Object@d234e69 to Foo." due to incorrect [RemoteClass] code generationAgile Board ExportXMLWordPrintableJSON Details Type: Bug Status: Closed Priority: Major Resolution: Fixed Affects Version/s: Adobe Flex SDK Previous Fix Version/s: Adobe Flex SDK 4.5 (Release) Component/s: .Unspecified - Compiler Labels: None Environment: Affected OS(s): All OS Platforms Affected OS(s): All OS Platforms Browser: Safari Language Found: English Description If a parent SWF loads two child SWFs that do AMF deserialization, and the child SWFs are deserializing a class that isn't present in the parent SWF, one of the children will receive a Type Coercion error. Steps to reproduce: 1. Load the attached projects into Flash Builder. 2. Run the Parent application, which loads two instances of the Child application. Actual Results: A Type Coercion error will occur. Expected Results: Deserialization should be successful. If you uncomment the registerClassAlias call in Child.mxml, there will be no error. Currently, [RemoteClass] generates code like this: try { if (flash.net.getClassByAlias("flex.messaging.io.ArrayCollection") == null) { flash.net.registerClassAlias("flex.messaging.io.ArrayCollection", mx.collections.ArrayCollection);} } catch (e:Error) { flash.net.registerClassAlias("flex.messaging.io.ArrayCollection", mx.collections.ArrayCollection); } In Flash Player 10.1, the test will fail in the second Child loaded and registerClassAlias will not be called as it should be. The simplest code change to achieve the correct effect would be to change the condition just slightly: try { if (flash.net.getClassByAlias("flex.messaging.io.ArrayCollection") != mx.collections.ArrayCollection){ flash.net.registerClassAlias("flex.messaging.io.ArrayCollection", mx.collections.ArrayCollection);} } catch (e:Error) { flash.net.registerClassAlias("flex.messaging.io.ArrayCollection", mx.collections.ArrayCollection); } Note the change in the initial condition. Simply doing flash.net.registerClassAlias("flex.messaging.io.ArrayCollection", mx.collections.ArrayCollection); achieves the same net result in notably less code. Workaround (if any): Manually calling registerClassAlias on all classes that have [RemoteClass] metadata is our current workaround. It is very error-prone, however, because the Flex SDK and other libraries have classes with [RemoteClass] and we have to manually register all of them too. Activity Ascending order - Click to sort in descending order All Comments Work Log History Activity Transitions Hide Permalink Adobe JIRA added a comment - 28/Jan/12 14:50 Adobe B