[Novice Problem] With CharacterFormat
Hi everybody,
I am working with TLF for few days and I don't understand something...
I have created a textflow, and I want to apply a style (color, fontFamily...) on selected characters
But when I use CharacterFormat, the style is applied on all the text.
My first try (juste change the colortext) :
Here I create my textflow :
private var _textFlow:TextFlow = null;
private var _container:Sprite = null;
public var manager:EditManager;
private function initNote():void
{
var controller:IContainerController;
_container = new Sprite();
textArea.rawChildren.addChild(_container);
_textFlow = new TextFlow ();
controller = new DisplayObjectContainerController(_container,textArea.width,textArea.height);
_textFlow.flowComposer.addController(controller);
_textFlow.addEventListener(StatusChangeEvent.INLINE_GRAPHIC_STATUS_CHANGED, graphicStatusChangeEvent);
manager = new EditManager(new UndoManager());
_textFlow.interactionManager = manager;
_textFlow.interactionManager.setSelection(0,0);
_textFlow.flowComposer.updateAllContainers();
_textFlow.interactionManager.setFocus();
}
Here, I want to apply the selected color
private function changeCharacterColor(event:ColorPickerEvent😞void
{
var cf:CharacterFormat = new CharacterFormat(currentNote.myTextFlow.characterFormat);
cf.color = colorChar.value;
currentNote.myTextFlow.characterFormat = cf;
currentNote.myTextFlow.flowComposer.updateAllContainers();
}
I checked the selection to be sure that it is good (thanks to the TextScrap options). But no problem on this side.
I try today with myTextFlow.interactionManager.selectionState.pointFormat = cf to apply the new color. But it doesn't work too.
I think I have miss something. Can somebody help me?
Thank you very much.
NB: Sorry for my bad english 😕😕 (poor french I am
)
