几个限定选项中选择一个的不同实现
1)下拉框Combobox <fx:Declarations> <fx:Model id="lbList"> ? ? </fx:Declarations> ? ? ? <fx:Script> protected function plcz_changeHandler(event:Event):void ??????? if(ComboBox(event.target).selectedItem.data=="01" && gridSplb.selectedItems!=null){ ? } ? ? ? ? ?]]> ? ? ? <mx:ComboBox height="25" id="plcz" dataProvider="{lbList.state}" change="plcz_changeHandler(event)"/> ? ? 2)DropDownList ? ?
<s:DropDownList id="alignVal" prompt="left" change="this.changeHandler()"> <s:dataProvider> <mx:ArrayList> <fx:String>left</fx:String> <fx:String>right</fx:String> <fx:String>center</fx:String> <fx:String>justify</fx:String> <fx:String>start</fx:String> <fx:String>end</fx:String> </mx:ArrayList> </s:dataProvider> </s:DropDownList> ? ? 3)FLEX4 相对 FLEX3的组件变化列表中列出以这么一项: mx.controls.ComboBox????? ->??? spark.components.DropDownList 官方解释如下: ??? ComboBox 控件是 DropDownListBase 控件的子类。与 DropDownListBase 控件类似,当用户从 ComboBox 控件的下拉列表中选择某项时,数据项将显示在控件的提示区域中。 ??? 这两个控件之间的一个区别是,ComboBox 控件的提示区域是使用 TextInput 控件实现的,而 DropDownList 控件是通过 Label 控件实现的。因此,用户可以编辑控件的提示区域,以输入非预定义选项之一的值。 ??? 例如,DropDownList 控件仅允许用户从控件的预定义项列表中进行选择。ComboBox 控件允许用户既可以从预定义项中选择,也可以在提示区域中输入新项。您的应用程序可以识别已输入一个新项,(可选)并将其添加到控件的项列表中。 (NumericStepper也可以在提示区域中输入新项? 如<s:NumericStepper? maximum="200" value="100" stepSize="2" />) ComboBox 控件还可以当用户在提示区域中输入字符时搜索项列表。当用户输入字符时,将打开控件的下拉区域,然后滚动到项列表中最接近的匹配项并加亮。 今天在测试使用<s:ComboBox dataProvider="{provider}" labelField="label"/>时发现编译没报错,但运行后却始终也显示不出控件。上网搜了一下,发现原来控件被替换了。 针对FLEX3中ComboBox的用法,在FLEX4中应改成以下用法: <s:DropDownList dataProvider="{provider}" labelField="label"/> 或 <mx:ComboBox dataProvider="{provider}" labelField="label"/> 需要注意的是: 1)DropDownList的DataProvider不能是Array类型的 2)DropDownList默认显示时与ComboBox不一样,需要手动指定 selectedIndex的值 下面给出一段示例: + expand sourceview plaincopy to clipboardprint?
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |