Hi!
this code would work for you

Selection.setFocus(txt);
Selection.setSelection(5,5);


Ganesh.

----- Original Message ----- From: "Martin Tremblay" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, January 23, 2007 12:58 AM
Subject: [Flashcoders] Dynamically placing caret in a textfield



I'm trying to place the caret at a specific position in a textfield, but
this seems to work only after I click at least once in the textfield.

But in my app, I CAN'T click, anybody know a way to get the caret to
blinking at a specific position without clicking in the textfield first
??


Here's a code to try this at home:

- create an input text name "debug_txt" on the stage

Code:

this.moveCaret = function ()
{
var nCaret = Selection.getCaretIndex();

if (nCaret == -1)
{
Selection.setFocus(_root.debug_txt);
}

Selection.setSelection(nCaret + 1, nCaret + 1);

}
_root.debug_txt.text = "Hello World";
setInterval(moveCaret, 1500);




Martin T.
LVL
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to