PDA

View Full Version : Turning selected text into a string


gyzhor
01-27-2009, 05:52 PM
I've got some dynamic text where certain lines will select (via setSelection) upon clicking.

What I can't figure out is how to turn this selected text into a stored string I can then parse into usable sections.

What methods could I use to get a selected text into a string?

Any input appreciated, as always!
~gyz

gyzhor
01-27-2009, 10:10 PM
For anyone following, this is how I solved it.


myText.setSelection(startInt, endInt); ;
var lineIndex:int = myText.getLineIndexOfChar(startInt);
var selectedText:String = myText.getLineText(lineIndex);
var splitSelected:Array = selectedText.split(".");
newText.text = splitSelected[0];

gyzhor
01-28-2009, 08:18 PM
... Though it would be awfully nice to be able to select the entire paragraph, and not just single lines.

Any clues?

I'm looking at getText right now. Doesn't look like it quite fits the bill, but does anyone know more about it?

Thanks as always,
~gyz