Trouble styling with an external stylsheet
Hi all,
I have a project that has to support both an external stylesheet, and chinese and arabic character sets. I have made it as far as integrating the CSSFormatResolver class, and using the basic examples that come along with it to get up and running. Basically, new textfields are generated like this:
tlf = TextConverter.importToFlow(txt, TextConverter.TEXT_FIELD_HTML_FORMAT);
tlf.format = null;
// A CSSFormatResolver
tlf.formatResolver = styleservice.formatResolver;
// Choosing 500 as an arbitrary initial height, since I cannot use autoSize?
controller = new ContainerController(this, textwidth, 500);
tlf.flowComposer.addController(controller);
tlf.flowComposer.composeToPosition();
contentBounds = controller.getContentBounds();
controller.setCompositionSize(controller.compositionWidth, contentBounds.height);
tlf.flowComposer.updateAllControllers();
The above almost works entirely - everything except center aligning text. In the stylesheet, I'm writing that property like this:
.nav_button_hover {
...
#textAlign:center;
...
}
...but no luck - everything aligns left.
I think the above is ancillary though - my real problem is trying to understand how HTML text and styles should be updated in a TextFlow when relying on an external stylesheet. Consider a nav button that needs it's textDecoration value to respond (underline, none) as the user rolls over each selection. In the Old Way, I'd change the htmlText, styling the XML derived content with an external stylesheet and it looked a bit like this:
tf.styleSheet = styleservice.style;
tf.htmlText = "<span class='" + el.@style + "'>" + String(el) + "</span>";
I am essentially wondering what the new workflow is to accomplish that same thing - especially as it applies to an external stylesheet and the rollover example updating the textDecoration. That used to be just this:
tf.htmlText = "<span class='" + el.@hover_style + "'>" + String(el) + "</span>";
How would you accomplish it with a TextFlow? Or should I be using a TextFlow at all?
Thanks very much for any help - I am most grateful.
- Ken
