Groups | Blog | Home
all groups > flash actionscript > february 2004 >

flash actionscript : how to determine the curso position in a textfield


Virgil
2/20/2004 6:31:55 PM
Hi all,

I?m trying to determine the position of the cursor within a textfiled, if it
at the end or at the begining or in betweem characters is, but i can find
anything to do this, if anyone can help me i would be apreciated.

Thanks
Jim Esteban
2/22/2004 2:24:18 AM
flashsiva
2/23/2004 6:29:41 AM
i want to increse the cursor position in to one letter ahead.how can i make.we can do it in javascript by movestart().in flash how can we do it
regards,
Jim Esteban
2/23/2004 2:40:47 PM
Okay I'll take a stab at a function that increases the beginning index by one
and sets the span to zero.
function IncrementByOne(txtfld:TextField):Boolean
{
if(txtfld.length>0)
{
focusManager.setFocus(txtfld);
var pos:Number = Selection.getBeginIndex();
if(pos>-1)
{
Selection.setSelection(pos+1,pos+1);
}
else
{
return false;
}
}
else return false;
}

Something like that will work.
flashsiva
2/24/2004 8:32:48 AM
hai,
{
if(str1.length>0)
{
focusManager.setFocus(str1);
var pos:Number = Selection.getBeginIndex();
if(pos>-1)
{
Selection.setSelection(pos+1,pos+1);
}
else
{
return false;
}
}
else return false;
}


its working fine but going to next new line of the text box.
regards,
siva
AddThis Social Bookmark Button