7 Replies Latest reply on Aug 31, 2010 3:57 PM by suku511

    Type Coercion Error

    suku511

      Hi all,

       

      I am getting this error

       

       

      TypeError: Error #1034: Type Coercion failed: cannot convert flash.events::Event@cd1e589 to spark.events.IndexChangeEvent.

      at spark.accessibility::ListBaseAccImpl/eventHandler()[E:\dev\4.x\frameworks\projects\spark\ src\spark\accessibility\ListBaseAccImpl.as:402]

       

       

      I havent used any events except result event. I was trying to read an rss feed in flex 4 Can anyone help me out in figuring it out.

       

      Thanks in advance,

       

        • 1. Re: Type Coercion Error
          IMRAN R

          Can you show some part of your mxml?

          • 2. Re: Type Coercion Error
            rootsounds Level 4

            Whatever Spark list control you are using is throwing the error. Beyond that I haven't a clue without seeing some of your code.

            • 3. Re: Type Coercion Error
              suku511 Level 1

              Here is the code where list component is

               

               

              <?xml version="1.0" encoding="utf-8"?>

              <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

                 xmlns:s="library://ns.adobe.com/flex/spark"

                 xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" creationComplete="httpService.send()">

              <fx:Declarations>

              <!-- Place non-visual elements (e.g., services, value objects) here -->

              <s:HTTPService id="httpService"

                 url="http://feeds.feedburner.com/mnt/healthnews"

                 result="onResult( event )" />

              </fx:Declarations>

               

              <fx:Script>

              <![CDATA[

              import flash.net.navigateToURL;

               

              import mx.collections.ArrayCollection;

              import mx.controls.Alert;

              import mx.rpc.events.FaultEvent;

              import mx.rpc.events.ResultEvent;

              import mx.utils.ObjectUtil;

               

              [Bindable]

              private var loading : Boolean = true;

               

              [Bindable]

              private var rssCollection : ArrayCollection = new ArrayCollection;

               

              private function onResult( event : ResultEvent ) : void

              {

              var xy:ArrayCollection = event.result.rss.channel.item as ArrayCollection;

              list.dataProvider = xy;

               

              loading = false;

              }

               

              private function onFault( event : FaultEvent ) : void

              {

              Alert.show( ObjectUtil.toString( event.fault ), "Service Error" );

              loading = false;

              }

               

               

              ]]>

              </fx:Script>

               

              <s:List width="100%"

              height="100%"

              id="list"

              itemRenderer="rssListRenderer"

              />

              </s:Application>

               

               

              here is the item renderer code,_____________________________
              <?xml version="1.0" encoding="utf-8"?>
              <s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
              xmlns:s="library://ns.adobe.com/flex/spark"
              xmlns:mx="library://ns.adobe.com/flex/mx"
              autoDrawBackground="true" >
              <s:layout>
              <s:VerticalLayout>
              </s:VerticalLayout>
              </s:layout>
              <s:Label text="{data.title}"
              width="100%"
              fontWeight="bold"
              fontSize="14" />
              <mx:Text
              color="#333333"
              id="description"
              htmlText="{ data.description }"
              width="{ width }"
              />
              </s:ItemRenderer>
              • 4. Re: Type Coercion Error
                IMRAN R Level 1

                Error you mentioned that is raising only when you debug code? and it works fine

                if you directly run it.

                 

                --Imran

                • 5. Re: Type Coercion Error
                  suku511 Level 1

                  for me even if I run with out debugging also I am getting that error. Please let me know how to overcome this.

                  • 6. Re: Type Coercion Error
                    Flex harUI Adobe Employee

                    That is a known issue.  If you don't need accessibility, turn it off.  There

                    should be a bug filed already that might have other workarounds.

                    • 7. Re: Type Coercion Error
                      suku511 Level 1

                      Thanks for the info. It works when accessibility is disabled.