私は呼び出しから取得した XML を持っているので、すべての値はノードのラベルを除いて動的です (したがって、表示する必要がある appname があることがわかります)。appname を ComboBox に表示してから、同じノードの別のラベルから別の値を取得する必要があります。xml の構造は次のようになります。
<root>
<item>
<name>Hello</name>
<version>World</version>
</item>
<item>
<name>See_you</name>
<version>soon</version>
</item>
</root>
ここで、動的な値を持つ flex mx:ComboBox があり、ユーザーがラベル (Hello など) を選択すると、対応するノードの値と子の値を見つける必要があるため、World を返すことができます。
dataProvider を介して ComboBox のラベルを定義できるので、これで完了です。現在、選択した値を trace(event.currentTarget.selectedItem.@label); で取得できません。(私は ComboBox の変更ハンドラーを持っています) = それは 1 つの問題です。
2 番目の問題は、同じ親ノード (この場合) に別のノード値がある場合、xml オブジェクトからノード値を取得する方法です。
私はこれで立ち往生しており、時間が不足しています。助けてください。++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++ 私は私のmxmlにこのように持っています
<mx:AddChild relativeTo="{VGroup}">
<mx:ComboBox id="AppListBox" change="AppListBox_changeHandler(Event.CHANGE)"/>
</mx:AddChild>
次に、スクリプトにデータがある場合は、次のようにデータを提供します
AppListBox.dataProvider = appxml.item.appname.text();
appxml - その xml です
次に、選択したアイテムの値を取得しようとしましたが、そのように試しました:
protected function AppListBox_changeHandler(event:Event):void
{
trace(event.currentTarget.selectedItem.label);
trace(event.currentTarget.selectedItem.data);
trace(event.currentTarget.selectedItem.@label);
trace(AppListBox.selectedItem.label);
trace(AppListBox.selectedItem.@label);
trace(AppListBox.selectedItem.name);
何も表示されません。エラーでもない