TLFTextField and RTL direction in pure AS3 (no IDE or flex)

So I’ve been struggling all afternoon to get TLFTextfield to display direction = Direction.RTL without any success. The rtl text still flowed left to right. I just got it to work with the help of this post

Basically it’s just this bit:

var myFormat:TextLayoutFormat = new TextLayoutFormat();
var myTextFlow:TextFlow=tf.textFlow;
myTextFlow.hostFormat=myFormat;

…needs to go at the end and it all starts working. urgh.