自动完成Flex中的输入文本 [英] AutoComplete for input text in flex

查看:68
本文介绍了自动完成Flex中的输入文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,实际上我已经编写了用于自动完成输入文本的代码.所以我有两个显示在下面的文件.

Hi, Actually i have written a code for auto complete input text. So i have two file which is displayed below.

***********************************************************************************
FILE NAME: AutoComplete.mxml
***********************************************************************************

<mx:Application 
	xmlns:mx="http://www.adobe.com/2006/mxml" 
	xmlns:comp="assets.actionScript.*"
	backgroundColor="0"
	layout="absolute"
	>

	<mx:Script>
		<![CDATA[
			import mx.events.FlexEvent;
			import mx.collections.ArrayCollection;

			// to campare both components we need two different data provider
			[Bindable]			
			public var countries: Array = [
					{id: 0, name:"Monaco"},
					{id: 1, name:"Macau"},
					{id: 2, name:"Hong Kong"},
					{id: 3, name:"Singapore"},
					{id: 4, name:"Gibraltar"},
					{id: 5, name:"Vatican City"},
					{id: 6, name:"Malta"},
					{id: 7, name:"Bermuda"},
					{id: 8, name:"Maldives"},
					{id: 9, name:"Bahrain"},
					{id: 10, name:"Bangladesh"},
					{id: 11, name:"Channel Islands"},
					{id: 12, name:"Nauru"},
					{id: 13, name:"Taiwan"},
					{id: 14, name:"Barbados"},
					{id: 15, name:"Palestinian territories"},
					{id: 16, name:"Mauritius"},
					{id: 17, name:"Aruba"},
					{id: 18, name:"South Korea"},
					{id: 19, name:"San Marino"},
					{id: 20, name:"Puerto Rico"},
					{id: 21, name:"Tuvalu"},
					{id: 22, name:"Netherlands"},
					{id: 23, name:"Martinique"},
					{id: 24, name:"Comoros"},
					{id: 25, name:"Lebanon"},
					{id: 26, name:"Rwanda"},
					{id: 27, name:"Marshall Islands"},
					{id: 28, name:"Belgium"},
					{id: 29, name:"Japan"},
					{id: 30, name:"India"},
					{id: 31, name:"El Salvador"},
					{id: 32, name:"American Samoa"},
					{id: 33, name:"U.S. Virgin Islands"},
					{id: 34, name:"Sri Lanka"},
					{id: 35, name:"R union"},
					{id: 36, name:"Guam"},
					{id: 37, name:"Haiti"},
					{id: 38, name:"Saint Vincent"},
					{id: 39, name:"Israel"},
					{id: 40, name:"Saint Lucia"},
					{id: 41, name:"Philippines"},
					{id: 42, name:"Burundi"},
					{id: 43, name:"Guadeloupe"},
					{id: 44, name:"Grenada"},
					{id: 45, name:"Trinidad and Tobago"},
					{id: 46, name:"Vietnam"},
					{id: 47, name:"United Kingdom"},
					{id: 48, name:"Jamaica"},
					{id: 49, name:"Germany"},
					{id: 50, name:"Netherlands Antilles"},
											
				];								
		
	</mx:Script>
	<mx:Style>
		global 
		{
			font-family: 					Verdana;
			font-weight: 					normal;
			verticalGap: 					0;
			horizontalGap: 					0;
			padding-left: 					0;
			padding-right: 					0;
			padding-top: 					0;
			padding-bottom: 				0;
			
		}
		FormHeading 
		{
			font-size: 		10;
			font-weight:	normal;
		}
	</mx:Style>	
</mx:Application>

***********************************************************************************
FILE NAME: abc.mxml
***********************************************************************************

<mx:Application 
	xmlns:mx="http://www.adobe.com/2006/mxml" 
	xmlns:comp="assets.actionScript.*"
	backgroundColor="0"
	layout="absolute"
	applicationComplete="hello(event)"
	>
	
	<mx:Script>
		<![CDATA[
			import mx.controls.Alert;
			import mx.events.FlexEvent;
			import mx.collections.ArrayCollection;

			// to campare both components we need two different data provider
			[Bindable] private var data1: ArrayCollection;
			[Bindable] public var autoComp:AutoComplete;
			
		
	</mx:Script>
	
	<mx:HBox
		height="100%" width="100%">
		<mx:Form
			height="100%">			
			<mx:FormHeading 
				color="#FFFFFF"
				label="B) Modified version"  
				/>
				
			<mx:FormItem>		
				<comp:AutoCompleteModified id="acu" 
					width="180"
					dataProvider="{autoComp.countries}" 
					labelField="name" 
					/>		
			</mx:FormItem>
		</mx:Form>		
		
	</mx:HBox>
</mx:Application>
***********************************************************************************


实际上我在AutoComplete.mxml文件中创建了一个arraylist,并在另一个名为abc.mxml的文件中创建了一个Hbox,但是这里我在AutoComplete.mxml文件中创建的arraylist并没有绑定在abc.mxml中(实际上我想调用该arraylist这是AutoComplete.mxml文件中的abc.mxml文件),因此请帮助我解决此问题.我正在新学习这些东西


Actually i crated a arraylist in AutoComplete.mxml file and i created a Hbox in one more file called abc.mxml, But here the arraylist which i created in AutoComplete.mxml file is not binding in abc.mxml(actually i want call the arraylist which is in AutoComplete.mxml file to abc.mxml)So please help me in this problem. I''m newly learning these things

推荐答案

检查此内容: http://hillelcoren.com/flex-autocomplete/ [ ^ ]

如果您想要自定义组件,特别是复杂的组件,则应始终检查是否有人已经在努力编写代码.在这种情况下,有人拥有.
check this: http://hillelcoren.com/flex-autocomplete/[^]

if you want custom components, especially complicated ones, you should always check whether someone already made the effort to code that. In this case someone has.


这篇关于自动完成Flex中的输入文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆