Package | gs.util.autosuggest |
Class | public class AutoSuggest |
The AutoSuggest class searches through the provided a list of terms for a specific search term. As an example, assume you had this list of words to search through:
Now assume you started typing "Fl", the auto suggest instance would return an array of AutoSuggestMatch instances; the two that matched were "Flash" and "Flex".
See also
Property | Defined by | ||
---|---|---|---|
terms : Array
The terms to search through.
| AutoSuggest |
Method | Defined by | ||
---|---|---|---|
AutoSuggest(terms:Array)
Constructor for AutoSuggest instances.
| AutoSuggest | ||
dispose():void
Dispose of this auto suggest instance.
| AutoSuggest | ||
search(str:String, caseSensitive:Boolean = false, matchAnywhere:Boolean = false, returnLowercaseMatches:Boolean = true):Array
Search for a string.
| AutoSuggest |
terms | property |
terms:Array
[read-write]The terms to search through.
Implementation public function get terms():Array
public function set terms(value:Array):void
AutoSuggest | () | constructor |
public function AutoSuggest(terms:Array)
Constructor for AutoSuggest instances.
Parametersterms:Array — An array of strings to search through.
|
dispose | () | method |
public function dispose():void
Dispose of this auto suggest instance.
search | () | method |
public function search(str:String, caseSensitive:Boolean = false, matchAnywhere:Boolean = false, returnLowercaseMatches:Boolean = true):Array
Search for a string.
Example usage:
import gs.util.autosuggest.AutoSuggest; var terms:Array=[ "George Bush", "Chaotmic Matter", "Particle Effects", "Word up", "Gangsta", "The Tony Danza Tap Dance Extravaganza", "Good bye", "Goodby","Gaa" ]; var ast:AutoSuggest=new AutoSuggest(terms,false); var a:ast.search("The Tony"); trace(a[0].term); trace(a[0].highlightedTerm); var b:ast.search("G",true) trace(b.length); var i:int=0; var l:int=b.length; for(;i<l;i++) { trace(b[i].term + " :: " + b[i].highlightedTerm); }
str:String — The string to search for.
|
|
caseSensitive:Boolean (default = false ) — Whether or not the search is case sensitive.
|
|
matchAnywhere:Boolean (default = false ) — Whether or not the search string has to be matched form the beginnging (^) of the string, or can the search string
be located anywhere in the string and still be considered a match.
|
|
returnLowercaseMatches:Boolean (default = true ) — Whether or not to return the matches as all lowercase strings.
|
Array |