6
我需要一些幫助以編程方式將所選項目設置在組合框中。Flex:以編程方式在組合框中設置選定的項目
我有一個組合框是這樣的:
<mx:ComboBox id="MyComboBox" change="puzzleHandler(event);" prompt="Make a Selection">
<mx:ArrayCollection id="myDP">
<mx:Object id="first" label="Label 1" series="2" pageTitle="Title 1"/>
<mx:Object id="second" label="Label 2" series="7" pageTitle="Title 2"/>
<mx:Object id="third" label="Label 3" series="9" pageTitle="Title 3"/>
</mx:ArrayCollection>
</mx:ComboBox>
我已經得到了關於深層鏈接的功能。如果有人輸入網址:www.mysite.com/#view=2,他們將被帶到網站的相應部分(無需在組合框中選擇標籤2)。如何以編程方式設置comboBox,以便它與所查看的用戶相對應?
在我的函數的switch語句中,我想將comboBox設置爲與視圖對應的標籤。如果「視圖= 2」,那麼組合框應該顯示「標籤2」被選中。
case "view=1":
MyComboBox.selectedItem.label="Label 1";
parseUrl();
case "view=2":
MyComboBox.selectedItem.label="Label 2";
parseUrl();
case "view=3":
MyComboBox.selectedItem.label="Label 3";
parseUrl();
我試過這個:MyComboBox.selectedItem.label =「Label 1」但它不工作。有什麼建議麼?
謝謝。
-Laxmidi
嗨,Flextras.com,比你的幫助。我選擇了第二種選擇,效果很好。謝謝! – Laxmidi 2011-01-26 20:18:28