Skip to main content
Aaronius9er9er
Inspiring
Apr 23, 2010 4:25 PM UTC
Question

Setting unfocusedSelectionFormat doesn't work when expected

I'm trying to set the unfocusedSelectionFormat so that when the text flow container loses focus the text stays selected (the range alpha remains at 1).

This works:

textFlow = new TextFlow();
Configuration(textFlow.configuration).unfocusedSelectionFormat = new SelectionFormat(0xffffff, 1, BlendMode.DIFFERENCE, 0xffffff, 0);

This doesn't:

var config:Configuration = Configuration(TextFlow.defaultConfiguration).clone();
config.unfocusedSelectionFormat = new SelectionFormat(0xffffff, 1, BlendMode.DIFFERENCE, 0xffffff, 0);
textFlow = new TextFlow(config);

Am I missing something?  It seems like the second way should work too.

This topic is closed to new replies. Start a new post to keep the conversation going.

2 replies

Adobe Employee
Apr 26, 2010 4:32 AM UTC

I find that your second example, where you make a clone of the Configuration and pass it to the TextFlow constructor is working. The first example is not, and that because changing the configuration of a TextFlow after its been constructed doesn't work -- the Configuration is essentially a way to initialize the TextFlow, but we don't support changing all the values after the TextFlow is constructed.

So, this works:

var config:Configuration = Configuration(TextFlow.defaultConfiguration).clone();

config.unfocusedSelectionFormat = new SelectionFormat(0xffff00, 1, BlendMode.DIFFERENCE, 0xffff00, 0);

var textFlow:TextFlow = TextConverter.importToFlow("Hello", TextConverter.PLAIN_TEXT_FORMAT, config);

And this doesn't:
var textFlow2:TextFlow = TextConverter.importToFlow("Hello", TextConverter.PLAIN_TEXT_FORMAT);
Configuration(textFlow.configuration).unfocusedSelectionFormat = new SelectionFormat(0xffff00, 1, BlendMode.DIFFERENCE, 0xffff00, 0);
And that is as expected.
Hope this helps,
- robin

Translate
Aaronius9er9er
Inspiring
Apr 26, 2010 4:48 AM UTC

That's what I was expecting, but I'm seeing the opposite.  My text container is within a custom UIComponent in Flex 3 if that makes any difference.  It doesn't matter a whole lot since I found a way that works, but if you want I can send you my examples.

Translate