私はモバイルベースのフレックスアプリケーションを開発しようとしています。FlexモバイルArrayCollectionエラー
私のアプリケーションでは、2つのビューがあります。
私は別のビューにあるビューからのデータとしてのArrayCollectionを渡すためにしようとしていますが、2番目のビューの上のArrayCollectionにアクセスしようとしている間、私はエラーを取得しています。..
はここでコードがfirstView.mxmlからです:
dirStepsが
...私は、次のビューに渡すためにしようとしていますArrayCollectionのです
DetailDirection.mxmlからコード:
[Bindable]
private var directionList:ArrayCollection;
private function init():void {
directionList = new ArrayCollection(ArrayUtil.toArray(data));
// here, data should be my arraycollection, but throws above error on
// trying to access property (i.e Step, Distance etc ..) of ArrayCollection ...
trace(data.Distance);
}
Error: Unknown Property: 'Distance'. at mx.collections::ListCollectionView/http://www.adobe.com/2006/actionscript/flash/proxy::getProperty()[E:\dev\4.y\frameworks\projects\framework\src\mx\collections\ListCollectionView.as:870] at views::DetailDirection/init()[C:\Documents and Settings\ARSENAL\Adobe Flash Builder 4.6\CityExplorer_v2.0\src\views\DetailDirection.mxml:21] at views::DetailDirection/___DetailDirection_View1_creationComplete()[C:\Documents and Settings\ARSENAL\Adobe Flash Builder 4.6\CityExplorer_v2.0\src\views\DetailDirection.mxml:6] at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.core::UIComponent/dispatchEvent()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:13152] at mx.core::UIComponent/set initialized()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:1818] at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:842] at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1180]
このエラーの原因は何?何をする必要がありますか?
ここでは何も欠けていますか?
'MyObjectType'は何ですかここに ?どのタイプのオブジェクトについて話していますか? – tomjerry
^ありがとうございます。あなたの努力が働いた。しかし、私の2番目のビューに 'data'の値を格納しようとすると、次のようになります。 ' private var arr:ArrayCollection = new ArrayCollection(ArrayUtil.toArray(data)); ' '(ArrayCollectionとしてのarr .getItemAt(0)MyObjectType).distance' ..「距離プロパティ不明」と同じエラーがスローされます... – tomjerry
@tomjerry「MyObjectType」はオブジェクトタイプです。あなたのdataProvider内のオブジェクトこのようなArrayCollectionを初期化すると、一度設定されます。おそらくデータプロパティが設定される前です。値にアクセスして何が間違っているのかを確認しようとすると、コードをステップ実行する必要があります。 ArrayCollectionは有効ですか?アクセスしようとしているアイテムがArrayCollectionに存在しますか?それは正しくキャストされていますか?そして最後に、それは距離のプロパティを持っていますか? – JeffryHouser