0

有没有办法颠倒组合框中项目的顺序?我想使用索引号来引用下面 arrayCollection 中的项目。我希望最新的内容首先出现在组合框中。但是,如果我在第一项之上添加一些东西,那么所有的索引号都会减一。如果我可以在 arrayCollection 的末尾添加一个新项目,但让它首先出现在组合框下拉列表中,这将解决很多问题。

<mx:ComboBox  id="MyComboBox" change="handler(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>

有什么建议么?

谢谢你。

-拉克西米迪

4

2 回答 2

1

我会通过向您的 ArrayCollection 添加排序来做到这一点。下面是一个示例:使用 SortField 和 Sort 类对 ArrayCollection 进行排序

于 2011-01-26T23:22:13.587 回答
1

只需使用方法 myDP.source.reverse()

于 2013-03-05T10:30:16.717 回答