# Forcing setfocus on a text area

**URL:** https://forum.kirupa.com/t/forcing-setfocus-on-a-text-area/289400
**Category:** Uncategorized
**Created:** [May 29, 2009, 7:59pm UTC](https://forum.kirupa.com/t/forcing-setfocus-on-a-text-area/289400 "2009-05-29T19:59:54Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Engywook](https://avatars.discourse-cdn.com/v4/letter/e/bc8723/32.png) [@Engywook](https://forum.kirupa.com/u/Engywook)
#### Post date: [May 29, 2009, 7:59pm UTC](https://forum.kirupa.com/t/forcing-setfocus-on-a-text-area/289400/1 "2009-05-29T19:59:54Z")

</div>

I’m dealing with an inline hyperlink in a textarea filled with htmlText. I’m getting incredibly vexxed by this problem with having to click the link twice.

I have learned [here](http://blog.flexcommunity.net/?p=38) that this is because the first time a link is clicked, the text area receives focus. Then links become activated. The workaround for this, according to the article, is:

> solve this by setting mouseOver = textFieldID.setFocus();

I really wish he’d set this in context, because no variant I’ve tried works.

```auto
mouseOver=showText.setFocus();

```

and

```auto
showSlice.mouseOver=showText.setFocus();

```

cause the link not to work at all. showSlice is the movie clip containing the textfield, which is called showText.

This isn’t as bad, but you still have to click the link twice (because I don’t think this is doing anything at all):

```auto

showSlice.onRollOver=function() {
showText.setFocus();
};

```

It’s a dynamically created textfield, and I am using AS2 in Flash 8. Code in full for this textarea is here:

```auto

			var showText:TextField=showSlice.createTextField(instanceName="showText", castMems, castX, castDrop, castWidth, 100);
			showText.embedFonts=true;
			showText.multiline=true;
			showText.setStyle("backgroundColor", "transparent");
			showText.wordWrap=true;
			showText.html=true;
			showText.autoSize=true;
			showText.htmlText=newCast;
			showText.setTextFormat(showFormat);
//links don't work at all with the next line uncommented
// showSlice.mouseOver=showText.setFocus();
//this doesn't seem to be doing a darned thing
			showSlice.onRollOver=function() {
				showText.setFocus();
			};

```

Really hope I don’t have to find a different way to do this…
