Components Flex


    
        
                
                [Bindable]
                private var probableMatches:Array;
    
                private var allWords:Array = ["apple", "boy", "cat"];
                private var regexp:RegExp;
    
                private function checkInput():void
                {
                    var temp:Array = allWords.filter(filter);
                    if(temp){
                        input.text = temp[0];
                    }
                }
    
                private function filter(element:*, index:int, arr:Array):Boolean
                {
                    regexp = new RegExp(input.text);
                    return (regexp.test(element as String));
                }