Trying to extract a piece text from an "HTML" textfield, then copying it into another HTML textfield, and highlighting( making BOLD) a section of it. Here's the code:

on (rollOver) {

beginning = Selection.getBeginIndex();
end = Selection.getEndIndex()
newtext = _root.text1.substr(0,beginning)+"<B>"+_root.text1. substr(beginning,end)+"</B>"+_root.text1.substr(end, _root.text1.length);

on (release) {

_root.text2 = newtext;
trace(_root.text2);
}

All the new textfield ends up being is gibberish HTML:

<P ALIGN="LEFT"><FONT FACE="Arial" SIZE="12" COLOR="#000000"></FONT></P><P ALIGN="LEFT"><FONT FACE="Arial" SIZE="12" COLOR="#000000">SDFGSDFG</FONT></P>

It seems to be extracting the HTML code as well. Any work arounds?