Reusable context menu?

i want a context menu that can be used with multiple textfield instances. how do u pass the textfield instance with the selection of the context menu

code so far:

//format textfield selection with bold/italics
var textfield_cm:ContextMenu = new ContextMenu();
textfield_cm.customItems.push(new ContextMenuItem(“Bold”, applyFormat));
textfield_cm.customItems.push(new ContextMenuItem(“Italic”, applyFormat));

function applyFormat(obj, menuItem) {
var startIndex:Number = Selection.getBeginIndex();
var endIndex:Number = Selection.getEndIndex();
var my_fmt:TextFormat = ttlTxt.getTextFormat(startIndex);
switch (menuItem.caption) {
case ‘Bold’ :
// toggle the bold property.
my_fmt.bold = !my_fmt.bold;
case ‘Italic’ :
my_fmt.italic = !my_fmt.italic;
ttlTxt.setTextFormat(startIndex, endIndex, my_fmt);
} = textfield_cm;

i also want to apply menu to = textfield_cm; = textfield_cm;

but ttlTxt is hardcoded in function :puzzle: