|
-
Senior Member
Here is how you get the visible text at a certain position. I used a button in this example and scrolled the text.
tf.text = "I have a Dynamic Text Field placed on stage at authortime. I need to truncate the text within that field by replacing the last VISIBLE word with an ellipse. Now, the problem I'm encountering is that in a multiline text box with wrapping turned on, I can't figure out a way to get the index of the last visible character, or some other point where I can start truncating. Part of the issue is that if you pass a really long SINGLE line string into the text field, Flash will wrap it like you would expect, however, the text gets masked if the text field isn't big enough to display it all, but the text that ISN'T visible still is factored into the values returned by AS3.0";
var myText:String = tf.text;
but.addEventListener (MouseEvent.CLICK, ch);
function ch (e:Event)
{
var myChar:int = tf.getCharIndexAtPoint(300,40);
trace (myText.charAt(myChar));
}
- The right of the People to create Flash movies shall not be infringed. -
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|