# Selection class

**URL:** <https://forum.kirupa.com/t/selection-class/143120>\
**Category:** Uncategorized\
**Created:** [April 3, 2005, 10:31am UTC](https://forum.kirupa.com/t/selection-class/143120 "2005-04-03T10:31:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nikini](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/nikini/32/225_2.png) [@Nikini](https://forum.kirupa.com/u/Nikini)\
**Post date:** [April 3, 2005, 10:31am UTC](https://forum.kirupa.com/t/selection-class/143120/1 "2005-04-03T10:31:06Z")

</div>

Let’s say we have an input text named “txt” and a button named “but”. I select a part of the text from the input text and after… i click the button and it must tell me the positions of the selection (beggining, end). How to do this? If i press the button, the focus goes on the button so i lose the selection… help…

```auto
on(release) {
	trace(Selection.getBeginIndex());
	trace(Selection.getEndIndex());
}

```

This is one of my codes that doesn’t work. Please help…
