find X and Y positions of the last word of a line in a dynamic text field

/ Published in: ActionScript 3
Save to your folder(s)

Copy this code and paste it in your HTML
  1. //mc is the mc
  2. //textfield is the textfield in question
  3. //mcX/Y is the position to place the mc after the text
  4. //getLineMetrics also returns ascent, descent, width, height, x, and leading
  6. var mcX:int=(textfield.x+textfield.getLineMetrics(textfield.numLines-1).width)+(mc.width+20);
  7. var mcY:int=(textfield.y+textfield.textHeight)+(mc.height+10);

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.