如何更改Flex ArrayCollection中项目的值(How do I change the value of an item in a Flex ArrayCollection)
我有一个预定义值的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;I have an ArrayCollection with values predefined. I want to assign a new value to items in the arrayCollection but can not figure out how. Basically I want to do something like this: acGuages.itemUpdated(0).thevalue = 90; (Changing the value from 25 to 90). Thanks.
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;最满意答案
ArrayCollection支持随机访问其元素,就像Array一样。 换句话说,你的路线:
acGuages.itemUpdated(0).thevalue = 90;可以改写为:
acGuages[0].thevalue = 90;它应该都按预期工作。
ArrayCollection supports random access to its elements, just like Array. In other words, your line:
acGuages.itemUpdated(0).thevalue = 90;Can be rewritten as:
acGuages[0].thevalue = 90;And it should all work as expected.
更多推荐
发布评论