2009-11-10 7 views
0
public function groupListRH(event:ResultEvent):void { 
    groupsList=event.result as ArrayCollection; 
} 

public function show(event):void { 
    selectedItem=(event.target as ComboBox).selectedIndex; 
    Alert.show(selectedItem.toString().groupId); 
} 

<mx:ComboBox dataProvider="{groupsList}" labelField="groupName" id="grpLst"width="150" prompt="Select One Group" change="show(event);" focusIn="init();" /> 

나는 어떻게 될지 모르겠다 ... 내가 선택한 groupName의 groupId (정확한 ID는 remotecject를 통해 arraycollection에 들어간다)를 얻을 수 있습니까?플렉스 어레이 콜렉션

답변

2

show() 메서드에서 groupId을 잡기 전에 selectedItem을 문자열로 변환합니다. 먼저 groupIdselectedItem에서 검색 할 수 있도록 전환해야합니다.

public function show(event):void { 
    Alert.show(selectedItem.groupId.toString()); 
} 

<mx:ComboBox id="grpLst" 
    width="150" 
    dataProvider="{groupsList}" 
    labelField="groupName" 
    prompt="Select One Group" 
    change="show(event);" 
/>