PDA

View Full Version : listFont combobox and selected text


jerryj
01-18-2006, 07:27 PM
Hi,

Not entirely a component question maybe but:

I have this code that changes the whole field to a font selected from a fontList combobox. But I would like to change only the selected piece of text.

The code is:
fontList.setDataProvider(TextField.getFontList());
fontList.sortItemsBy("label", "asc");
tf = new TextFormat();

this.onEnterFrame = function() {
fontList.onKillFocus = function() {
selecting = false;
};
fontList.onSetFocus = function() {
selecting = true;
};
if (selecting) {

tf.font = fontList.getValue();
field.setTextFormat(tf);
}
}

But how can I integrate something like this code in it?

tf.font= "Arial";
currentFormat = field.getTextFormat(begin, end);
Selection.setFocus(field);
Selection.setSelection(begin, end);
field.setTextFormat(begin, end, tf);

I've done several attempts, but no luck (or wisdom).

thank you,

Jerryj.

jerryj
02-03-2006, 05:33 PM
anyone?