Copy link to clipboard
Copied
Hi
I am making a standalone text field display the full word as the user types, but the word has to be from the choices in a ComboBox.
So as they type "a", if the first choice in the ComboBox is "apple", apple is displayed in the text box. Then they type "aw", then if "aware" is the first "aw' word in the combobox, aware is displayed etc
I'm about 1/3 the way through coding it, and thought I'd ask here is there is a standard way of doing this?
//for simplicity`s sake I use strings, if you have a Combo´Box with a DataProvider simply use that instead
var strings:Array = ["america","australia","alligator","anchorman"];
strings.sort();
tf.addEventListener(Event.CHANGE, autocomplete);
function autocomplete(e:Event):void
{
var input:Array = e.target.text.split("");
for (var i:uint = 0; i<input.length; i++)
{
for (var j:uint = 0; j<strings.length; j++)
{
for (var k:uint = 0; k<strings
{
...
Copy link to clipboard
Copied
//for simplicity`s sake I use strings, if you have a Combo´Box with a DataProvider simply use that instead
var strings:Array = ["america","australia","alligator","anchorman"];
strings.sort();
tf.addEventListener(Event.CHANGE, autocomplete);
function autocomplete(e:Event):void
{
var input:Array = e.target.text.split("");
for (var i:uint = 0; i<input.length; i++)
{
for (var j:uint = 0; j<strings.length; j++)
{
for (var k:uint = 0; k<strings
{
var arrstrings:Array = strings
if (input == arrstrings
{
e.target.text = strings
e.target.setSelection(0,e.target.text.length);
return;
}
else
{
e.target.text = "NO MATCH FOUND";
e.target.setSelection(0,e.target.text.length);
}
}
}
}
}
Copy link to clipboard
Copied
Thanks Mocca. This was the pefect framework to get me going.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now