Hi,

After a lot of searching I'm still unable to replace text that is selected. I want to use this for a sort of word-processor. With HTML formatted text I hope then to be able to make buttons for bold, italic and underlined text. (select; press button > bold)

What I have found is this:

(input textfield has the var name 'TextBox')
button:
code:

on(rollOver){
startSel = Selection.getBeginIndex();
endSel = Selection.getEndIndex();
oldSelection = Selection.getFocus();
if (endSel - startSel > 1){
selected = "true";
}else{
selected = "false";
}
}
on (release) {

if (selected eq "true"){
Selection.setFocus(oldSelection);
Selection.setSelection(startSel,endSel);
TextBox.replaceSel("new text");
}
}



With this code the selected text stays selected after pressing the button (that's good) but nothing will be replaced

Any-one out there able to help me?
I would be most greatfull