Listコンポーネントのサンプルです。
Listコンポーネントは、プロパティdataProviderで設定。
OKボタン(okbtn)の他に選択解除ボタン(clearbtn)を用意。
clearbtn.addEventListener(MouseEvent.CLICK , clearfunc); // 選択解除 okbtn.addEventListener(MouseEvent.CLICK , okfunc); // OKボタン // 選択解除 function clearfunc(e:Event):void{ list.clearSelection(); txt.text = "選択を解除しました"; } //OK function okfunc(e:Event):void{ if( list.selectedItem == null ){ txt.text = "選択されていません"; }else{ txt.text = list.selectedItem.data; // value を表示 } }
コメント