0

我有一个预定义值的 ArrayCollection。我想为 arrayCollection 中的项目分配一个新值,但不知道如何。基本上我想做这样的事情:acGuages.itemUpdated(0).thevalue = 90; (将值从 25 更改为 90)。谢谢。

    private var arrayGuages:Array=[
        {thevalue:"25",height:"115"},
        {thevalue:"45",height:"115"},
        {thevalue:"15",height:"115"},
        {thevalue:"95",height:"115"},
        ];

    [Bindable] 
    public var acGuages:ArrayCollection=new ArrayCollection(arrayGuages);

    acGuages.itemUpdated(0).thevalue = 90;
4

1 回答 1

2

ArrayCollection 支持对其元素的随机访问,就像 Array. 换句话说,你的行:

acGuages.itemUpdated(0).thevalue = 90;

可以改写为:

acGuages[0].thevalue = 90;

它应该按预期工作。

于 2009-11-27T18:41:23.430 回答