<? XML version = "1.0" encoding = "UTF-8"?> <S: Application xmlns: FX = "http://ns.adobe.com/mxml/2009" xmlns: S = "Library: // ns.adobe.com/flex/spark" xmlns: MX = "Library: // ns.adobe.com/flex/mx "minwidth =" 955 "minheight =" 600 "creationcomplete =" Startup (event) "> <FX: declarations> <! -- Place non-visual elements (such as services and value objects) Here --> </FX: declarations> <FX: SCRIPT> <! [CDATA [import MX. controls. alert; import MX. controls. checkbox; import MX. events. flexevent; // appids [Bindable] public var adminappids: array; Public var arr: array = new array (); // initialize protected function startup (Event: flexevent): void {arr. push ("123", "345", "456"); var check: checkbox; For (var I: Int = 0; I <arr. length; I ++) {check = new checkbox (); check. id = "C" + I; check. label = arr [I]; check. selected = false; appids. addelem ENT (check) ;}} protected function button?clickhandler (Event: mouseevent): void {for (var I: Int = 0; I <arr. length; I ++) {var check: checkbox = checkbox (appids. getchildat (I); alert. show ("" + check. selected, "" + I) ;}}]> </FX: SCRIPT> <FX: declarations> <! -- Place non-visual elements (such as services and value objects) Here --> </FX: declarations> <s: panel title = "selector"> <s: vscrollbar x = "190" Y = "-1" Height = "100%" viewport = "{appids}"/> <s: vgroup id = "appids" Left = "10" Height = "100%" clipandenablescrolling = "true"> </S: vgroup> <s: controlbarcontent> <s: button label = "OK" Click = "button#clickhandler (event)"/> <s: button label = "cancel"/> </S: controlbarcontent> </s: panel> </S: Application>