Click here to Skip to main content
15,921,113 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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>
***********************************************************************************

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
Posted
Updated 10-Feb-12 20:59pm
v5

1 solution

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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900