如何获得Flex数组元素

时间:2009-08-18 13:39:52

标签: flex arrays

大家好我有这样的数组

public var dataAL:Array=[
    {Kiv:"cash",                   jan:26,janTarget:28,feb:27,febTarget:26,mar:30,marTarget:32,apr:31,aprTarget:32,may:28,mayTarget:29,jun:46,junTarget:32,jul:37,julTarget:39,aug:40,augTarget:42,sep:41,sepTarget:42,oct:48,octTarget:49,nov:40,novTarget:41,dec:38,decTarget:40},
    {Kiv:"Short term investments", jan:36,janTarget:38,feb:32,febTarget:36,mar:33,marTarget:34,apr:32,aprTarget:35,may:38,mayTarget:39,jun:46,junTarget:32,jul:37,julTarget:39,aug:40,augTarget:42,sep:41,sepTarget:42,oct:48,octTarget:49,nov:40,novTarget:41,dec:38,decTarget:40},
    {Kiv:"Bonds",                  jan:46,janTarget:32,feb:37,febTarget:39,mar:40,marTarget:42,apr:41,aprTarget:42,may:48,mayTarget:49,jun:46,junTarget:32,jul:37,julTarget:39,aug:40,augTarget:42,sep:41,sepTarget:42,oct:48,octTarget:49,nov:40,novTarget:41,dec:38,decTarget:40 },
    {Kiv:"Preferred Stock",        jan:16,janTarget:18,feb:17,febTarget:16,mar:10,marTarget:12,apr:11,aprTarget:12,may:18,mayTarget:19,jun:46,junTarget:32,jul:37,julTarget:39,aug:40,augTarget:42,sep:41,sepTarget:42,oct:48,octTarget:49,nov:40,novTarget:41,dec:38,decTarget:40},
    {Kiv:"Common Stock",           jan:21,janTarget:21,feb:28,febTarget:29,mar:30,marTarget:32,apr:41,aprTarget:42,may:33,mayTarget:36,jun:46,junTarget:32,jul:37,julTarget:39,aug:40,augTarget:42,sep:41,sepTarget:42,oct:48,octTarget:49,nov:40,novTarget:41,dec:38,decTarget:40}

];

现在,如果我想以现金方式访问febTarget,我将如何做?

1 个答案:

答案 0 :(得分:2)

for each( var obj:Object in dataAL ){

  trace( obj.febTarget );

}

trace( dataAL[0].febTarget );

for each( var obj:Object in dataAL ){

  if( obj.Kiv == "cash" )           
    trace( obj.febTarget );

}