1 Reply Latest reply on Jul 9, 2013 4:13 PM by markerline

    TypeError: Error #1034: Type Coercion failed...

    markerline Level 4

      I have the following ActionScript Error:

       

      TypeError: Error #1034: Type Coercion failed: cannot convert videos::Feed@c98e041 to mx.collections.IList.

          at Function/<anonymous>()[C:\flex45tfs\FlexGrocerC\YouTubeInspector\src\YouTubeInspector.mxm l:41]

          at Function/http://adobe.com/AS3/2006/builtin::apply()

          at mx.binding::Binding/wrapFunctionCall()[E:\dev\4.y\frameworks\projects\framework\src\mx\bi nding\Binding.as:395]

          at mx.binding::Binding/innerExecute()[E:\dev\4.y\frameworks\projects\framework\src\mx\bindin g\Binding.as:469]

          at Function/http://adobe.com/AS3/2006/builtin::apply()

          at mx.binding::Binding/wrapFunctionCall()[E:\dev\4.y\frameworks\projects\framework\src\mx\bi nding\Binding.as:395]

          at mx.binding::Binding/execute()[E:\dev\4.y\frameworks\projects\framework\src\mx\binding\Bin ding.as:333]

          at mx.binding::Binding/watcherFired()[E:\dev\4.y\frameworks\projects\framework\src\mx\bindin g\Binding.as:511]

          at mx.binding::Watcher/notifyListeners()[E:\dev\4.y\frameworks\projects\framework\src\mx\bin ding\Watcher.as:311]

          at mx.binding::PropertyWatcher/eventHandler()[E:\dev\4.y\frameworks\projects\framework\src\m x\binding\PropertyWatcher.as:377]

          at flash.events::EventDispatcher/dispatchEventFunction()

          at flash.events::EventDispatcher/dispatchEvent()

          at mx.rpc::CallResponder/set lastResult()

          at mx.rpc::CallResponder/result()[E:\dev\4.y\frameworks\projects\rpc\src\mx\rpc\CallResponde r.as:120]

          at mx.rpc::AsyncToken/http://www.adobe.com/2006/flex/mx/internal::applyResult()[E:\dev\4.y\frameworks\projects\rpc\src\mx\rpc\AsyncToken.as:239]

          at mx.rpc.events::ResultEvent/http://www.adobe.com/2006/flex/mx/internal::callTokenResponders()[E:\dev\4.y\frameworks\projects\rpc\src\mx\rpc\events\ResultEvent.as:207]

          at mx.rpc::AbstractOperation/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()[E:\dev\4.y\frameworks\projects\rpc\src\mx\rpc\AbstractOperation.as:244]

          at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()[E:\dev\4.y\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:318]

          at mx.rpc::Responder/result()[E:\dev\4.y\frameworks\projects\rpc\src\mx\rpc\Responder.as:56]

          at mx.rpc::AsyncRequest/acknowledge()[E:\dev\4.y\frameworks\projects\rpc\src\mx\rpc\AsyncReq uest.as:84]

          at DirectHTTPMessageResponder/completeHandler()[E:\dev\4.y\frameworks\projects\rpc\src\mx\me ssaging\channels\DirectHTTPChannel.as:451]

          at flash.events::EventDispatcher/dispatchEventFunction()

          at flash.events::EventDispatcher/dispatchEvent()

          at flash.net::URLLoader/onComplete()

       

       

      using Flash Builder 4.7 / Flex SDK 4.6.0 .... The code will follow...

        • 1. Re: TypeError: Error #1034: Type Coercion failed...
          markerline Level 4

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

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

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

                                 xmlns:mx="library://ns.adobe.com/flex/mx"

                                 xmlns:elements="org.osmf.elements.*"

                                 xmlns:most_popular="services.most_popular.*"

                                 width="960" height="850" currentState="Normal">

              <fx:Declarations>

                  <s:CallResponder id="getDataResult"/>

                  <most_popular:Most_popular id="most_popular"

                                             fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)"

                                             result="currentState = 'Normal'"

                                             showBusyCursor="true"/>

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

              </fx:Declarations>

              <fx:Script>

                  <![CDATA[

                      import mx.controls.Alert;

                      import mx.events.FlexEvent;

                     

                      private function getLabelField(item:Object):String{

                          return item.media_group.media_title.title;

                      }

                      protected function getData():void

                      {

                          getDataResult.token = most_popular.getData();

                      }

                     

                  ]]>

              </fx:Script>

              <s:states>

                  <s:State name="Normal"/>

                  <s:State name="Loading"/>

                  <s:State name="Error"/>

              </s:states>

              <s:List id="videoList" labelFunction="getLabelField"

                      width="300" height="580"

                      x="10" y="10" creationComplete="getData()" labelField="id">

                  <s:dataProvider>

                     

                      <s:AsyncListView list="{getDataResult.lastResult}" />

                  </s:dataProvider>

              </s:List>

              <mx:SWFLoader id="videoDisplay" x="320" y="10"/>

                 

              <mx:ColumnChart x="980" y="10">

                 

                  <mx:series>

                     

                      <mx:ColumnSeries />

                      <mx:ColumnSeries />

                      <mx:ColumnSeries />

                  </mx:series>

              </mx:ColumnChart>

              <s:Label x="10" y="618" text="Loading . . . "

                       includeIn="Error,Loading"

                       text.Error="Error in loading video list"

                       color.Error="#FF0000"/>

          </s:WindowedApplication>

           

           

          -------------------------

           

          I'm trying to follow a tutorial for displaying YouTube videos in a Flex application but since it's MX+Spark I'm thinking the error has to do with the fact that MX is throwing an error.