actionscript 3 - Get the XY position of the caret in TextArea -


i need xy position of caret in textarea.

i found way y, dont know how x, can help?

if any1 want know, how y:

var textbeforecaret:string = text.substr(0, caretindex); var textdump:string = this.text; this.text = textbeforecaret; this.validatenow(); yvariable = this.textheight; this.text = textdump; 

after checking link rafh, did this:

var popupx:int = 0; var popupy:int = 0; if(text.length > 0){  if(caretindex > 0){                                 if(this.textfield.getcharboundaries(caretindex -1) != null){ popupx = this.textfield.getcharboundaries(caretindex - 1).right; popupy = this.textfield.getcharboundaries(caretindex - 1).bottom; } else{ popupx = 0; var i:int = 2;                                     while(this.textfield.getcharboundaries(caretindex - i) == null && caretindex - > -1){ i++; } if(caretindex - > -1){ popupy = this.textfield.getcharboundaries(caretindex - i).bottom + * 10; } else{ popupy = * 10; } } } else{ popupx = this.textfield.getcharboundaries(caretindex).right; popupy = this.textfield.getcharboundaries(caretindex).bottom; } } else{ popupx = 0; popupy = 0; } 

it isnt perfect, enough me


Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -