Flex下拉框

<?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" 
			   creationComplete="initHandler(event)"
			   width="100%" height="100%" fontSize="12"
			   fontFamily="微软雅黑">
	<s:layout>
		<s:BasicLayout/>
	</s:layout>
	<fx:Script>
		<![CDATA[
			import mx.collections.ArrayCollection;
			import mx.controls.Alert;
			import mx.events.FlexEvent;
			import mx.events.ItemClickEvent;
			
			import spark.events.IndexChangeEvent;
			
			[Bindable]
			private var comArray:ArrayCollection = new ArrayCollection([
				{dateType:"日",areaDesc:"北京"},{dateType:"月",areaDesc:"上海"},{dateType:"日",areaDesc:"深圳"},areaDesc:"武汉"},areaDesc:"兰州"},areaDesc:"天津"}
			]);

			/**
			 * 初始化函数
			 */
			protected function initHandler(event:FlexEvent):void
			{
				
			}

			/**
			 * 改变下拉框
			 */
			protected function comboBox_changeHandler(event:IndexChangeEvent):void
			{
				for each(var com:Object in comArray)
				{
					if(com.dateType == "日")
					{
						date.visible = true;
						month.visible = false;
					}
					else if(com.dateType == "月")
					{
						date.visible = false;
						month.visible = true;
					}
				}
			}

			/**
			 * 
			 */
			protected function radio_itemClickHandler(event:ItemClickEvent):void
			{
				
			}

		]]>
	</fx:Script>
	<fx:Declarations>
		<s:RadioButtonGroup id="radio" itemClick="radio_itemClickHandler(event)"/>
	</fx:Declarations>
	
	<mx:VBox width="100%" height="100%" paddingTop="20" paddingBottom="10" paddingLeft="10" 
			 paddingRight="20">
		<mx:HBox width="100%" height="60" verticalAlign="middle" borderColor="0x000000" borderStyle="solid"
				 horizontalAlign="center">
			<s:Label text="日期类型:"/>
			<s:RadioButton id="dayStr" groupName="radio" label="日"/>
			<s:RadioButton id="monthStr" groupName="radio" label="月"/>
			<mx:DateField id="date" formatString="YYYY-MM-DD" width="200"/>
			<s:Label width="50"/>
			<mx:DateField id="month" formatString="YYYY-MM" width="200"/>
			<s:Label width="50"/>
			<s:Label text="地域:"/>
			<s:ComboBox id="comboBox" width="200" dataProvider="{comArray}" labelField="areaDesc" selectedindex="0"
						change="comboBox_changeHandler(event)"/>
		</mx:HBox>
	</mx:VBox>
	
</s:Application>

相关文章

一:display:flex布局display:flex是一种布局方式。它即可以...
1. flex设置元素垂直居中对齐在之前的一篇文章中记载过如何...
移动端开发知识点pc端软件和移动端apppc端软件是什么,有哪些...
最近挺忙的,准备考试,还有其他的事,没时间研究东西,快周...
display:flex;把容器设置为弹性盒模型(设置为弹性盒模型之后...
我在网页上运行了一个Flex应用程序,我想使用Command←组合键...