Developer Network Home  Help 

YDN Flash Developer Center Astra Flex Components AutoCompleteManager
Flash Developer Center

ASTRA AutoCompleteManager

AutoCompleteManager manages a set of input controls, popping up suggestions when a user types into one of the fields. Instead of replacing TextInput fields with a specific AutoComplete control, you can simply point the manager to one or more TextInputs, and you'll get a slick pop-up or auto-fill interaction.

Getting Started: AutoCompleteManager for Flex 3

AutoCompleteManager is not a visual control, but manifests itself as one. You can place an instance of AutoCompleteManager in your Flex application, and point it to one or more TextInput controls. Based on the id of those controls, an auto-completion pop-up or auto-fill will occur.

Creating an AutoCompleteManager with a TextInput

You can create an AutoCompleteManager in MXML very easily. First, you must import the yahoo namespace for the Astra Flex controls. Simply add xmlns:yahoo="http://www.yahoo.com/astra/2006/mxml" to your application or MXML component declaration.

To tell AutoCompleteManager which TextInput controls you want it to work with, use the target property (for one item) or targets property (for multiple items).

Screen capture of AutoCompleteManager Simple Example

To see a live example, please install Adobe Flash Player version 9 or higher.

Download the MXML example file.

Creating an AutoCompleteManager with a Form

You can also point the target to a Form or other Container to have it work with all TextInputs in the container. You can event point it to your entire application to enable it on all TextInput fields in the application.

Screen capture of AutoCompleteManager Form Example

To see a live example, please install Adobe Flash Player version 9 or higher.

Download the MXML example file.

Creating a Standalone AutoComplete Field with Custom Data

You can even use AutoCompleteManger like a typical AutoComplete control with your own custom data. The following example shows a single TextInput with auto-completion coming from a list of airports. It uses a custom filter function to allow filtering based on not only one field, but multiple fields. That way, in this example, you can type in a city, airport code, or airport name. Using the minCharsForCompletion property, this example will only display auto-complete when three or more characters have been typed into the field.

Screen capture of AutoCompleteManager DataProvider Example

To see a live example, please install Adobe Flash Player version 9 or higher.

Download the MXML example file.

For additional topics, please read Using AutoCompleteManager, or take a look at the Examples section for functional demonstrations. The ActionScript 3.0 Class Reference contains full details on every property, method, and style available to the AutoCompleteManager component.