0

我需要一些帮助来访问 Flex 3 中的 arrayCollection 中的值。

变量 f:字符串;

我需要访问其中 series = f 的 photoFilePath。所以如果f=2,那么我需要/pics/my2.png

所以,伪代码:myAc.(series="f").photoFilePath

<mx:ArrayCollection id="myAC">
    <mx:Object label="Label 1" series="1" photoFilePath="/pics/my1.png" pageTitle="First"/>
    <mx:Object label="Label 2" series="2" photoFilePath="/pics/my2.png" pageTitle="Second"/>
</mx:ArrayCollection>

有什么建议么。

谢谢你。

-拉克西米迪

4

1 回答 1

0
var n:int = myAC.length;
var f:String;
for (var i:int = 0; i < n; i++)
{
    var item:Object = myAC.getItemAt(i);
    if (item.series == f)
    {
        trace(item.photoFilePath);
        break;
    }
}
于 2010-11-02T20:32:48.097 回答