I'm trying to take the letters I have in a string var, eg "EXAMPLE", and display them in a textField like so:
Maybe I'm trying to make it too complicated, but I can't seem to figure it out. I'm using the following code:
var str:String = segmentName;
var re:RegExp = /(\S)/;
var results_array:Array = str.split(re);
for (var i2:String in results_array)
text_field_mc.text = results_array[i2];
The textFeild shows nothing (the textField is coded correctly, as it shows regular strings). However, the trace shows it as:
I've got the textfield set large enough to accomodate the text.
Is there a better way to split a string into individual letters, and then display them in a field one above the other? I thought \n\r might have come into it, but I can't make them fit into the above example.
Do you need to split the string up, or do you just need to display as you wish? If you don't need to split it up...
var str:String = "EXAMPLE";
for (var i:uint=0; i<str.length; i++)
- I'll try that in the morning.