chaining text : what the smater way ?
Hi I am chaining text beetween diferents textfield. I find a way to do this by cheking the last caracter of the first textfield using getCharIndexAtPoint... and then cut the string using substring
It works but I want to know if ther is a smarter way to do this
here is the code. I don't like the "while (contrPt<0)" part of the code .. in some case this could bring some trouble
var aaaa : String = "aaaaa aaaa a a aaaa a a a a a aa a aa a a a aaaaa aaa aaaa a aa aa aa aaaaaa aaaaaaa aaaaaa a aa aa aaa aaaa aaaaa aaaaaaa aaaaaaaa aaaaaaaaa aaaaaaaaaa aaaaaaaaaaa aaaaaaaaa aaa aaa aaaa aaa aaaa aaaa aaaa "
var txtCour:TextFormat = new TextFormat();
txtCour.size = 14
txtCour.font = "Trebuchet MS"
txtCour.kerning = true
var contrPt : Number = -1
var inc : Number = 1
var TtA : TextField = new TextField() ; TtA.wordWrap = true ; TtA.multiline = true;
TtA.defaultTextFormat = txtCour
TtA.text = aaaa
TtA.x = 132; TtA.y = 10
TtA.width = 100 ;TtA.height = 100
addChild ( TtA)
while (contrPt<0){
contrPt = TtA.getCharIndexAtPoint(TtA.width - inc, TtA.height -5)
inc ++}
trace ( contrPt)