Офигенный пример из хэлпа к Flash MX Pro 7.2

Код:
this.createTextField("output_txt", this.getNextHighestDepth(), 0, 0, 300, 200);
output_txt.multiline = true;
output_txt.wordWrap = true;
output_txt.border = true;
output_txt.type = "input";
output_txt.text = "Enter your text here";
var my_cm:ContextMenu = new ContextMenu();
my_cm.customItems.push(new ContextMenuItem("Uppercase...", doUppercase));
function doUppercase():Void {
var startIndex:Number = Selection.getBeginIndex();
var endIndex:Number = Selection.getEndIndex();
var stringToUppercase:String = output_txt.text.substring(startIndex, endIndex);
output_txt.replaceText(startIndex, endIndex, stringToUppercase.toUpperCase());
}
output_txt.menu = my_cm;