Selection.setfocus

Well, i know, it sounds easy, but the only thing I want to do is make a textfield that’s always focused. When I click next to the textfield on a picture or on the root the focus changes and that’s not what I need, the textfield has to stay focused. Could anyone give me that script please?

Thank you so much

Are you saying that the text field should be focused even when something else, for example picture, gets clicked???

that’s right, I think it’s possible. don’t you? :nerd:

Well… you can have a listener or something running all the time and have that refocus your text field, I guess… But I don’t understand why you want to do it though…

I’ll show you Go here When you lose the focus, it’s hard to get it back because there’s a mask running over it. I tried using a listener, but i don’t quite understand how to do that… :frowning:

Well… If that is the case… =)

Something like this might work… (Untested…)

Selection.setFocus("_level0.focusMe");

focusListener = new Object();
focusListener.onMouseDown = function ()
{
	if (Selection.getFocus() != "_level0.focusMe")
	{
		Selection.setFocus("_level0.focusMe");
	}
}
Mouse.addListener(focusListener);

Do some more searching on the forum regarding the listener and setFocus…

BTW, that alpha tween in that site almost killed my PII 300… :-\

Not a perfect one, but here is a simple sample that might help you understand how this thing can be done… Good luck… :wink:

thank you so much, it’s great, but… when you kill the focus it selects the text, is their a way to unselect it again?

and what do you mean by almost killed my PII300, is it to slow? mm, i’ll work on it, but it’s not CPU intensive

Use Selection.setSelection() to select the last one in the text field so that the selection won’t be made…

As for alpha tween… Yes… When the alpha tween happened, my machine almost froze until the alpha tween was happening… Alpha tween for the big portion of the screen is supposed to be CPU intensive though…