Package | ardisia.components.autoFitText |
Class | public class AutoFitLabel |
Inheritance | AutoFitLabel spark.components.Label |
View the technical documentation on the Ardisia Labs website for more information.
DESIGN NOTES
Since the spark Label does not support TLF, intra-word wrapping cannot be stopped via the "breakOpportunity" style. AutoFitRichText does support the "breakOpportunity" style.
Scaling will not work because the entire component will scale, not just the text.
Default MXML Propertytext
Property | Defined By | ||
---|---|---|---|
ignoreWordLength : Number
Any words with less than or equal to the number of characters defined by
this property will not be included in the word count. | AutoFitLabel | ||
maxFontSize : Number
The maximum allowed fontSize. | AutoFitLabel | ||
minFontSize : Number
The minimum allowed fontSize. | AutoFitLabel | ||
precisionThreshold : Number
The font size precision used by the class to determine when the fit is
'good enough', in pixels. | AutoFitLabel |
Method | Defined By | ||
---|---|---|---|
AutoFitLabel | |||
dispose():void
Call to remove the component from the display list and remove any
event listeners. | AutoFitLabel | ||
fitText():void
Will set the label fontSize to fill the available space without
truncation. | AutoFitLabel |
Method | Defined By | ||
---|---|---|---|
calculateWordCount():void
Determines the number of words in the "text" property string. | AutoFitLabel | ||
eventHandler(event:Event):void
Handles events on the control. | AutoFitLabel | ||
getNumLines():Number
Returns the number of lines. | AutoFitLabel |
ignoreWordLength | property |
ignoreWordLength:Number
Any words with less than or equal to the number of characters defined by this property will not be included in the word count. This is relevant because the number of line breaks cannot exceed the word count.
The default value is 3
.
public function get ignoreWordLength():Number
public function set ignoreWordLength(value:Number):void
maxFontSize | property |
maxFontSize:Number
The maximum allowed fontSize.
The default value is 60
.
public function get maxFontSize():Number
public function set maxFontSize(value:Number):void
minFontSize | property |
minFontSize:Number
The minimum allowed fontSize.
The default value is 6
.
public function get minFontSize():Number
public function set minFontSize(value:Number):void
precisionThreshold | property |
precisionThreshold:Number
The font size precision used by the class to determine when the fit is 'good enough', in pixels.
Higher values will increase performance but not fit as optimally.
The default value is 2
.
public function get precisionThreshold():Number
public function set precisionThreshold(value:Number):void
AutoFitLabel | () | Constructor |
public function AutoFitLabel()
calculateWordCount | () | method |
protected function calculateWordCount():void
Determines the number of words in the "text" property string. Ignores any words with a character length less than the "ignoreWordLength" property.
dispose | () | method |
public function dispose():void
Call to remove the component from the display list and remove any event listeners.
eventHandler | () | method |
protected function eventHandler(event:Event):void
Handles events on the control.
Parameters
event:Event — the Event that triggered the handler
|
fitText | () | method |
public function fitText():void
Will set the label fontSize to fill the available space without truncation.
Should be called automatically when the dimensions of the component change.
getNumLines | () | method |
protected function getNumLines():Number
Returns the number of lines.
ReturnsNumber — int of the number of lines
|