【发布时间】:2011-01-26 19:26:34
【问题描述】:
我需要一些帮助,以编程方式在组合框中设置所选项目。
我有一个这样的组合框:
<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)。如何以编程方式设置组合框,使其与用户查看的内容相对应?
在我的函数的 switch 语句中,我想将组合框设置为与视图对应的标签。如果“view=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" 但它不起作用。有什么建议么?
谢谢。
-拉克西米迪
【问题讨论】:
标签: apache-flex combobox