The combination of input and autoSize is what's killing you. Do you
really need the textfield to resize with the text entry?
If not, you're better off setting the width and height explicitly.
However, if you don't know the size before you enter text, then here is an
alternative:
TextField.prototype.resizeToMatchText = function()
{
this.autoSize = 'none';
this._width =
this.getTextFormat().getTextExtent(this.text).textFieldWidth + 4;
this._height =
this.getTextFormat().getTextExtent(this.text).textFieldHeight;
this.hscroll = 0;
}
createTextField('txf',1,0,0,0,0);
txf.type = "input";
txf.autoSize = "left";
txf.multiline = false;
txf.wordWrap = false;
txf.border = true;
txf.text = "test";
txf.resizeToMatchText();
If you need the textfield to resize with text entry add this:
txf.onChanged = txf.resizeToMatchText;
and then call txf.onChanged() after you set the text property. Setting
the text property through AS won't trigger the onChanged event so you'll
have to do that manually anytime you change the text property.
You'll need to call resizeToMatchText() after a TextFormat change as well.
Nasty? Perhaps.
Processor-friendly? Yes.
Effective? Yes.
Derek Vadneau
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of fla coder
Sent: Friday, January 06, 2006 6:19 AM
To: [email protected]
Subject: [Flashcoders] input text scrolls when pressing right arrow key
hi
please try the following:
create a TextField with properties similar to:
txf.type = "input";
txf.autoSize = "left";
txf.multiline = false;
txf.wordWrap = false;
txf.text = "test";
run the movie and click inside the field.
press the right cursor key until you reach the last character in the
field.
(the last 't' of 'text').
now, if you press the right cursor key again, the word scrolls to the
left.
my question is, is there any way to stop this behaviour?
open to nasty, but processor friendly tricks if that is the only way...
many thanks
fla
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders