访问DataGrid中组件的属性.

如何访问 DataGrid中控件的属性呢? 这个问题问了好多地方,一直感觉一定有个类似C#中的findControl的方法,终于有了答案~来自AS3天地会。
< mx:DataGrid  id ="musicList"  width ="100%"  textAlign ="center"  dataProvider =" {myFavorite} "  bottom ="9"  top ="0" >
                          
< mx:columns >
                                 
< mx:DataGridColumn  headerText ="操作" >
                                        
< mx:itemRenderer >
                                               
< mx:Component >
                                                      
< mx:HBox  horizontalAlign ="center" >
                                                             
< mx:Button  id ="bt1"  styleName ="localMusicButton"  click ="parentDocument.dataGridDownLoadButtonClick(event)" />
                                                             
< mx:Button  id ="bt2"  styleName ="gdplayButton"  click ="parentDocument.dataGridButtonClick(event)" />
                                                      
</ mx:HBox >
                                               
</ mx:Component >
                                        
</ mx:itemRenderer >
                                 
</ mx:DataGridColumn >                                
                                
< mx:DataGridColumn  headerText ="歌名"  dataField ="songName" />
                                  
</ mx:columns >
                   
</ mx:DataGrid >

我想访问id为bt1的Button的属性,怎么做呢?

解决方法:

musicList.indexToItemRenderer(musicList.selectedIndex).document.bt1

你可能感兴趣的:(datagrid)