Hi there,
i couldn’t find anything about it, so is there a way to address individual letters in a dynamic textfield? I’d like to do some text tweenings but could not find a poper way of instanciating single letters. Of course it is possible to create a new textfield for text-values stored in an array, but this seem to be quite inefficient to me.
I’m guessing the simplest/quickest way is going to be something like this
var greeting:String = myDynamicText.text;
var characters:Array = brokenApart(greeting);
trace(characters); // h,e,l,l,o,,, ,f,r,o,m, ,L,e,e,d,s
function brokenApart(inText:String):Array
{
var retVal:Array = new Array();
for(var i:int = 0; i < inText.length; i++)
{
retVal.push((inText.substr(i,1)));
}
return retVal;
} // end brokenApart
Obviously, if you wanted, you could make the brokenApart function more selective, so that it ignored spaces and/or punctuation, or only included characters on a given list.
Thanks, DiamonDog. Your functions splits up text into substrings, which can be quite handy sometimes. Maybe I was not clear enough, but i’m looking for a way to address single letters as a Display Object to do various manipulations like text-effects etc. Guess there will be no quick & easy way…