Skip to main content
Inspiring
February 24, 2012
Question

X, Y position of character based on index

  • February 24, 2012
  • 2 replies
  • 2160 views

Hey everyone,

Does anyone know how to get the X and Y coordinates of a character in a string based on index?  I find it odd that I can get the exact letter and index by clicking a character in a text field, but I haven't found anything in code that can get those coordinates without a user click.  Seems like they would have to know the x,y of the individual indexs to be able to tell you what letter you're clicking based on your own mouse coordinates.

This topic has been closed for replies.

2 replies

Participant
November 15, 2016

Does anyone have any ideas how this can be done with createjs?

Need to overlay specific strings within a textfield.

Cheers.

kglad
Community Expert
Community Expert
February 24, 2012

if you're using a tlftextfield, you can use the getCharAtPoint() method.

Inspiring
February 24, 2012

That's what I've been using to get characters and indexes.  I'm trying to get the x and y location of a character by simply feeding it the index of the string.

kglad
Community Expert
Community Expert
February 24, 2012

iterate through your textfield indices using that method to find the corresponding x,y