码迷,mamicode.com
首页 > 其他好文 > 详细

Flex下拉框

时间:2019-02-16 13:44:39      阅读:220      评论:0      收藏:0      [点我收藏+]

标签:else   elf   blog   bind   center   version   com   add   XML   

<?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:"深圳"},
				{dateType:"月",areaDesc:"武汉"},
				{dateType:"日",areaDesc:"兰州"},
				{dateType:"月",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>

再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.csdn.net/jiangjunshow

Flex下拉框

标签:else   elf   blog   bind   center   version   com   add   XML   

原文地址:https://www.cnblogs.com/odejsjhshw/p/10387425.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!