2013-05-31 50 views
0

我建立一個Flex移動應用程序,我不斷收到此錯誤:Flex的強制錯誤類型#1034

TypeError: Error #1034: Type Coercion failed: cannot convert mx.collections::[email protected] to Array. 

它說,錯誤是在這裏發生(在ArrayCollection的部分):

<s:List id="invites" x="5" y="295" width="310" change="rowSelected(event)"> 
     <s:dataProvider> 
      <s:ArrayCollection source="{getInvites.lastResult.Invites.EventTitle}"/> 
     </s:dataProvider> 
    </s:List> 

的「getInvites」 HTTPService調用:

<s:HTTPService id="getInvites" result="getInvitesResult(event)" method="POST" url="http://localhost/invite.php" useProxy="false"> 
      <s:request xmlns=""> 
       <method>GET_INVITES</method> 
       <userID>{my_id.text}</userID> 
      </s:request> 
     </s:HTTPService> 

我不知道爲什麼這個錯誤發生,我一直在嘗試網絡將其排出2小時。任何幫助,高度讚賞。

此外,還可以訪問「invite.php」文件,並且工作正常。

感謝, 雅各

回答

0

最有可能的遠程服務將返回在getInvites.lastResult.Invites.EventTitle數組是不一樣的一個ArrayCollection,不能「對飛」轉變。

你可以試試這個:

<s:List id="invites" x="5" y="295" width="310" change="rowSelected(event)"> 
     <s:dataProvider> 
      <s:ArrayCollection source="{new ArrayCollection(getInvites.lastResult.Invites.EventTitle)}"/> 
     </s:dataProvider> 
    </s:List> 

不過,老實說,我強烈建議你添加一個正確的結果處理程序,以您的HTTPService調用並處理的結果。

相關問題