# setSelection alternative for TextField

**URL:** <https://forum.kirupa.com/t/setselection-alternative-for-textfield/268253>\
**Category:** flash\
**Created:** [August 11, 2008, 10:22pm UTC](https://forum.kirupa.com/t/setselection-alternative-for-textfield/268253 "2008-08-11T22:22:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrew79](https://avatars.discourse-cdn.com/v4/letter/a/c67d28/32.png) [@andrew79](https://forum.kirupa.com/u/andrew79)\
**Post date:** [August 11, 2008, 10:22pm UTC](https://forum.kirupa.com/t/setselection-alternative-for-textfield/268253/1 "2008-08-11T22:22:40Z")

</div>

Hi folks,

I have a flex application that uses TextField and I want like to know how to clear the selection on selected text .  
I’ve used setSelection(0,0) but that just cause the next highlight to begin from index 0. Is there a way to clear it out so that the user can select/highlight words from anywhere from the textfield instead of having setSelection anchor index to be at 0 ?

```auto
 
this.thisTextField.addEventListener(MouseEvent.MOUSE_OUT,highlightMe);
tf.setSelection(0,0);

```
