Note that there are some explanatory texts on larger screens.

plurals
  1. POFlex: find next instance of string in TextArea
    primarykey
    data
    text
    <p>I have a TextArea, a TextInput and a button. When text is entered into the TextInput the TextArea is searched for the matching string, however it only highlights the first found instance of the string. How can I do a 'find next' type of operation.</p> <pre><code>protected function searchBtn_clickHandler():void { text = mainTextField.text; search_Str = searchTxt.text; var search_result:int = text.search(search_Str); trace(search_result); mainTextField.setFocus(); mainTextField.selectRange(search_result,search_result+search_Str.length); } </code></pre> <p><strong>EDIT</strong></p> <pre><code>protected function searchBtn_clickHandler():void { text = mainTextField.text; search_Str = searchTxt.text; search_result = text.search(search_Str); trace(search_result); mainTextField.setFocus(); mainTextField.selectRange(search_result,search_result+search_Str.length); oldSearch_result = search_result; } protected function findNextBtn_clickHandler():void { search_Str = searchTxt.text; // truncate the text using substring; this gives you everything in mainTextField after your previous search results var truncatedText:String = mainTextField.text.substring(oldSearch_result+search_Str.length); search_result = truncatedText.search(search_Str); mainTextField.setFocus(); // when you select the range, you want to offset your result index w/ the characters your chopped off mainTextField.selectRange(oldSearch_result+search_Str.length+search_result,search_result+search_Str.length); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload