# setPosition not working inside listener

**URL:** <https://forum.kirupa.com/t/setposition-not-working-inside-listener/210965>\
**Category:** flash\
**Created:** [December 24, 2006, 7:43pm UTC](https://forum.kirupa.com/t/setposition-not-working-inside-listener/210965 "2006-12-24T19:43:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![govtcheeze](https://avatars.discourse-cdn.com/v4/letter/g/8e8cbc/32.png) [@govtcheeze](https://forum.kirupa.com/u/govtcheeze)\
**Post date:** [December 24, 2006, 7:43pm UTC](https://forum.kirupa.com/t/setposition-not-working-inside-listener/210965/1 "2006-12-24T19:43:35Z")

</div>

```auto
tellKeyListener = new Object();
tellKeyListener.onKeyUp = function () {
    if (Key.getAscii() == ord('t') && inputMsg.htmlText == "t") {
  inputMsg.htmlText = "/tell ";
  inputMsg.setSelection(6,6);
 } 
}
Key.addListener(tellKeyListener);

```

I have this listener added to the chat room here on this site, and everything works except the setting of the cursor to the end of the "/tell ". It currently puts it between the “/” and the “t” (where the regular ‘t’ would go). I tried breaking it out of the if statement, but it still did not move the cursor.

How can I place the cursor at the end of the text string "/tell "?
