Hi Flexcoders,
Does anybody know the secret to scaling a multi-line text container (e.g. a TextArea) while preserving the flow (line wrapping) of the text?
I want to be able to 'zoom in' on a TextArea while keeping the text flow the the same as it was.
I would have expected that when I set scaleX and scaleY properties on the TextArea that the whole thing grows bigger while keeping the text flow essentially the same, but this isn't the case.
There appears to be some kind of rounding error or the text isn't scaled in proportion because it jitters all over the place and the line wrapping changes.
I have tried scaling the TextArea directly, a parent of the TextArea, and even pulling out the TextArea's internal TextField and scaling that. All have the same results. I've also tried with embedded fonts.
Does anyone know how to make the text behave itself?
Example code is attached.
Cheers and many thanks to all,
Lach
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:view="com.bremy.print.view.*"
layout="absolute" >
<mx:HSlider horizontalCenter="0" y="100"
minimum="0.5" maximum="2" liveDragging="true"
change="scaleText(event)" />
<mx:VBox id="box" horizontalCenter="0" verticalCenter="0"
horizontalAlign="center" verticalGap="20"
backgroundColor="white">
<mx:TextArea id="area"
paddingLeft="10" paddingRight="10"
width="300" height="300"
text="{text}" />
</mx:VBox>
<mx:Script>
<![CDATA[
import mx.events.SliderEvent;
protected function scaleText (event:SliderEvent):void {
area.scaleX = event.value;
area.scaleY = event.value;
}
private const text:String = "Duis, velit nulla, accumsan magna,
veniam. " +
"Consequat nibh sed vero erat dolore ea
aliquam duis at exerci " +
"ullamcorper dolor. Velit ut iusto, enim consequat vulputate
enim " +
"enim facilisi autem nulla. Amet accumsan lobortis, ut eum,
vulputate, " +
"vero blandit et dolore consequat veniam quis duis wisi vero.
Ex, " +
"dignissim delenit commodo, hendrerit molestie et augue odio ex
nisl " +
"tation odio iriure veniam eum. Luptatum consequat autem.
Consequat " +
"molestie facilisi qui nulla. In accumsan vero, ut. Et,
vulputate, " +
"consequat, blandit, aliquip dolore, ipsum veniam dolore duis
delenit " +
"vero dolore dignissim accumsan."
]]>
</mx:Script>
</mx:Application>
smime.p7s
Description: S/MIME cryptographic signature

