Avg. Rating 4.0

Problem

Text component seems to fail wordWrapping after its style is removed at runtime. Especially if the style also removes fontFamily value.

Solution

The solution is to force wordWrapping as the last action before the component is visible. For that I set the textField value of wordWrap to true on updateComplete event.

Detailed explanation

<mx:Text id="lrgTxt" text="text that normaly would wrap after it is launched!" color="#FFFFFF" width="760" fontSize="15" updateComplete="lrgTxt.mx_internal::getTextField().wordWrap=true" paddingLeft="11" styleName="iL" leading="7" fontAntiAliasType="advanced" fontGridFitType="pixel"/>
 

/* the removal of style is as follows:

StyleManager.clearStyleDeclaration(".iL", true);

*/


+
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. Permissions beyond the scope of this license, pertaining to the examples of code included within this work are available at Adobe.

Report abuse

Related recipes