Posts

Showing posts from May, 2009

Flex Auto Complete / Predictive Text Example

Ok this basically works with a change event placed on a textInput or other component you can modify it to your needs <-- First the action script --> <-- Now create a variable that will be your dictionary this can come from a query or whatever --> private var xDictionary:Array = ["Alan","Brad","Cindy","Dana","Elizabeth","Frank"]; private var regexp:RegExp; private function xTestInput():void{ var i:int = 0; var temp:Array = xDictionary.filter(filter); txInput.text = temp[0]; } private function filter(element:*,index:int,arr:Array):Boolean{ regexp = new RegExp(txInput.text); return (regexp.test(element as String)); } <-- And in your MXML -->