Name

text (LzText) — The basic text display element.

Synopsis

LZX: text
JavaScript: LzText
Type: Class
Access: public
Topic: LFC.Text
Declared in: WEB-INF/lps/lfc/views/LzText.lzs

Description

This class is used for non-editable text fields (as opposed to tagname inputtext. A text field can be initalized with text content at compile time.

 
 <canvas height="30">
   <text>Hello world!</text>
 </canvas>
 

Note that certain attributes on text objects, such as opacity and rotation, only work on embedded fonts. They do not work on client fonts (also called platform fonts, native fonts, platform fonts, etc). See the Developer's Guide for details.

Development Note

This is for regular and input text.

Superclass Chain

node (LzNode) » view (LzView) » text (LzText)

Known Subclasses

Known Direct Subclasses: inputtext (LzInputText)

Details

Static Properties (1)

escapeChars
static public var escapeChars = { ... };

Initial Attributes (9)

Initial Attributes are given as attributes in LZX but are not generally available as properties in JavaScript.

font
<attribute name="font" type="string" />
fontsize
<attribute name="fontsize" type="number" />
fontstyle
<attribute name="fontstyle" type="string" />
maxlength
<attribute name="maxlength" type="number" />
maximum number of characters allowed in this field default: null
multiline
<attribute name="multiline" type="boolean" />
password
<attribute name="password" type="boolean" />
pattern
<attribute name="pattern" type="string" />
regexp describing set of characters allowed in this field Restrict the characters that can be entered to a pattern specified by a regular expression. Currently only the expression [ ]* enclosing a set of characters or character ranges, preceded by an optional "^", is supported. examples: [0-9]* , [a-zA-Z0-9]*, [^0-9]* default: null width and height are virtual properties -- they have setters and getters, but the actual state is stored in the text sprite. They are documented in the superclass, LzView, as well. height: The height of the text field. A Number. If unspecified, then the height of the text field will be set by default to enclose the initial text value. width: The width of the text field. A Number. If width is not explicitly supplied, the text field will by default be sized to fit the width of the initial text value.
resize
<attribute name="resize" type="boolean" />
text
<attribute name="text" type="string" />

Properties (8)

colorstring
<attribute name="colorstring" />
public var colorstring = #000000;
hscroll
<attribute name="hscroll" />
private var hscroll = 0.0;
maxhscroll
<attribute name="maxhscroll" />
private var maxhscroll = 0.0;
maxscroll
<attribute name="maxscroll" />
private var maxscroll = 0.0;
multiline
<attribute name="multiline" type="boolean" value=""false"" />
public final var multiline : Boolean;
If true, the lines of text are wrapped to fit within the text width. (The name multiline is a misnomer. Unwrapped text can be multiple lines if it contains a <br /> or <p> element, or a line break within a <pre> element. This attribute defaults to true if width and height are explicitly specified. If you set multiline=true, you probably want to explicitly a width for the text also; if multiline=true and you do not specify a width, the system will pick an arbitrary width (100 pixels at the moment). When multiline=true, the text is automatially re-wrapped whenever the content is modified by calls to setText, or whenever the width of the text view is modified.
resize
<attribute name="resize" type="booleanLiteral" />
public var resize : BooleanLiteral = true;
If true, the width of the text field will be recomputed each time setText() is called, so that the text view is exactly as wide as the width of the widest line. Defaults to true.
scroll
<attribute name="scroll" />
private var scroll = 0.0;
text
<attribute name="text" type="string" />
public var text : String;
The text to display in this text field.

Setters (11)

Setters for virtual properties, to be used with setAttribute. A setter may or may not have a corresponding getter method; consult the Methods list in this section.

font
fontsize
fontstyle
maxlength
multiline
pattern
resize
selectable
If true, the text is selectable
text
xscroll
yscroll

Methods (40)

addText()
<method name="addText" args="t" />
public function addText(t : String);
Appends the string to the current text in the textfield.
annotateAAimg()
<method name="annotateAAimg" args="txt" />
private function annotateAAimg(txt);
applyData()
<method name="applyData" args="d" />
private function applyData(d);
clearText()
<method name="clearText" />
public function clearText();
Clears the text field (by setting its text to the empty string)
construct()
<method name="construct" args="parent, args" />
private function construct(parent, args);
escapeText()
<method name="escapeText" args="ts" />
public function escapeText(ts : String);
Returns an escaped version of the string if called with no args. If called with a string argument, returns an escaped version of that string (escaped here means markup-escaped, hot http escaped.)
getBottomScroll()
<method name="getBottomScroll" />
private function getBottomScroll();
getDefaultWidth()
<method name="getDefaultWidth" />
private function getDefaultWidth();
Width to use for text field if none is specified
getMaxScroll()
<method name="getMaxScroll" />
private function getMaxScroll();
getMCRef()
<method name="getMCRef" />
private function getMCRef();
Get a reference to the control mc (overridden from LzView)
getScroll()
<method name="getScroll" />
private function getScroll();
getSelectionPosition()
<method name="getSelectionPosition" />
public function getSelectionPosition() : Number;
Returns the position of the text cursor within this object. If the text cursor is not inside this object, then the method returns -1.
getSelectionSize()
<method name="getSelectionSize" />
public function getSelectionSize() : Number;
Returns the length of the text selection in within this object. If the text cursor is not inside this object, then the method returns -1.
getText()
<method name="getText" />
public function getText();
Returns the string represented in the text field @return: The string in the text field
getTextHeight()
<method name="getTextHeight" />
public function getTextHeight();
Calculates the current height of the text held by the text field.
getTextWidth()
<method name="getTextWidth" />
public function getTextWidth();
Calculates the current width of the text held by the text field.
init()
<method name="init" />
public function init();
__makeSprite()
<method name="__makeSprite" args="args" />
private function __makeSprite(args);
Called to create the sprite object. May be overridden to use a specific version, e.g. LzTextSprite();
parseImgAttributes()
<method name="parseImgAttributes" args="attrs, str" />
private function parseImgAttributes(attrs, str);
setBorder()
<method name="setBorder" args="onroff" />
private function setBorder(onroff);
setEmbedFonts()
<method name="setEmbedFonts" args="onroff" />
private function setEmbedFonts(onroff);
setFontName()
<method name="setFontName" args="fname" />
private function setFontName(fname);
setFontSize()
<method name="setFontSize" args="fsize" />
private function setFontSize(fsize);
setFontStyle()
<method name="setFontStyle" args="fstyle" />
private function setFontStyle(fstyle);
setHScroll()
<method name="setHScroll" args="s" />
public function setHScroll(s);
setMaxLength()
<method name="setMaxLength" args="val" />
private function setMaxLength(val);
setMultiline()
<method name="setMultiline" args="ml" />
public function setMultiline(ml : Boolean);
Sets whether or not the textfield wraps. If false, only a single line of text will appear and extra lines will be trucated if the text is set with multiple lines.
setPattern()
<method name="setPattern" args="val" />
private function setPattern(val);
setResize()
<method name="setResize" args="val" />
public function setResize(val : Boolean);
setResize set behavior of text field width when new text is added. LzText only (cannot be used with LzInputText).
setScroll()
<method name="setScroll" args="s" />
public function setScroll(s);
setSelectable()
<method name="setSelectable" args="isSel" />
public function setSelectable(isSel : Boolean);
Sets the selectability (with Ibeam cursor) of the text field
setSelection()
<method name="setSelection" args="start, end" />
public function setSelection(start : Number, end : Number);
Positions the text selection within the text field. If this object does not already have the focus, this has the ancillary effect of giving it the focus.
setText()
<method name="setText" args="t" />
public function setText(t : String);
setText sets the text of the field to display
setWidth()
<method name="setWidth" args="val" />
private function setWidth(val);
setWordWrap()
<method name="setWordWrap" args="wrap" />
private function setWordWrap(wrap);
setXScroll()
<method name="setXScroll" args="n" />
public function setXScroll(n : Number);
Set the x scroll position of the textfield.
setYScroll()
<method name="setYScroll" args="n" />
public function setYScroll(n : Number);
Set the y scroll position of the textfield.
toString()
<method name="toString" />
private function toString();
__updatefieldsize()
<method name="__updatefieldsize" />
private function __updatefieldsize();
Note: When this is called, "this" will be the Flash TextField object, not the LzText class, because this is called as a method on __LZtextclip from __LZforceScrollAttrs
updateMaxLines()
<method name="updateMaxLines" />
private function updateMaxLines();
This must be called after updating the measurement. This is done for speed.

Events (5)

onmaxlength
<attribute name="onmaxlength" />
public event onmaxlength;
onmaxscroll
<attribute name="onmaxscroll" />
public event onmaxscroll;
onpattern
<attribute name="onpattern" />
public event onpattern;
onscroll
<attribute name="onscroll" />
public event onscroll;
ontext
<attribute name="ontext" />
public event ontext;
Sent whenever the text in the field changes.

LZX Synopsis

<class name="LzText" extends=" LzView ">
  <attribute name=" colorstring " />
  <attribute name=" hscroll " />
  <attribute name=" maxhscroll " />
  <attribute name=" maxscroll " />
  <attribute name=" multiline " type="boolean" value=""false"" />
  <attribute name=" resize " type="booleanLiteral" />
  <attribute name=" scroll " />
  <attribute name=" text " type="string" />
  <method name=" addText " args="t" />
  <method name=" annotateAAimg " args="txt" />
  <method name=" applyData " args="d" />
  <method name=" clearText " />
  <method name=" construct " args="parent, args" />
  <method name=" escapeText " args="ts" />
  <method name=" getBottomScroll " />
  <method name=" getDefaultWidth " />
  <method name=" getMaxScroll " />
  <method name=" getMCRef " />
  <method name=" getScroll " />
  <method name=" getSelectionPosition " />
  <method name=" getSelectionSize " />
  <method name=" getText " />
  <method name=" getTextHeight " />
  <method name=" getTextWidth " />
  <method name=" init " />
  <method name=" __makeSprite " args="args" />
  <event name=" onmaxlength " />
  <event name=" onmaxscroll " />
  <event name=" onpattern " />
  <event name=" onscroll " />
  <event name=" ontext " />
  <method name=" parseImgAttributes " args="attrs, str" />
  <method name=" setBorder " args="onroff" />
  <method name=" setEmbedFonts " args="onroff" />
  <method name=" setFontName " args="fname" />
  <method name=" setFontSize " args="fsize" />
  <method name=" setFontStyle " args="fstyle" />
  <method name=" setHScroll " args="s" />
  <method name=" setMaxLength " args="val" />
  <method name=" setMultiline " args="ml" />
  <method name=" setPattern " args="val" />
  <method name=" setResize " args="val" />
  <method name=" setScroll " args="s" />
  <method name=" setSelectable " args="isSel" />
  <method name=" setSelection " args="start, end" />
  <method name=" setText " args="t" />
  <method name=" setWidth " args="val" />
  <method name=" setWordWrap " args="wrap" />
  <method name=" setXScroll " args="n" />
  <method name=" setYScroll " args="n" />
  <method name=" toString " />
  <method name=" __updatefieldsize " />
  <method name=" updateMaxLines " />
</class>

JavaScript Synopsis

public LzText extends  LzView  {
  static public var escapeChars  = { ... };
  public var colorstring  = #000000;
  private var hscroll  = 0.0;
  private var maxhscroll  = 0.0;
  private var maxscroll  = 0.0;
  public final var multiline  : Boolean;
  public var resize  : BooleanLiteral = true;
  private var scroll  = 0.0;
  public var text  : String;
  prototype public function addText (t : String);
  prototype private function annotateAAimg (txt);
  prototype private function applyData (d);
  prototype public function clearText ();
  prototype private function construct (parent, args);
  prototype public function escapeText (ts : String);
  prototype private function getBottomScroll ();
  prototype private function getDefaultWidth ();
  prototype private function getMaxScroll ();
  prototype private function getMCRef ();
  prototype private function getScroll ();
  prototype public function getSelectionPosition () : Number;
  prototype public function getSelectionSize () : Number;
  prototype public function getText ();
  prototype public function getTextHeight ();
  prototype public function getTextWidth ();
  prototype public function init ();
  prototype private function __makeSprite (args);
  prototype public event onmaxlength ;
  prototype public event onmaxscroll ;
  prototype public event onpattern ;
  prototype public event onscroll ;
  prototype public event ontext ;
  prototype private function parseImgAttributes (attrs, str);
  prototype private function setBorder (onroff);
  prototype private function setEmbedFonts (onroff);
  prototype private function setFontName (fname);
  prototype private function setFontSize (fsize);
  prototype private function setFontStyle (fstyle);
  prototype public function setHScroll (s);
  prototype private function setMaxLength (val);
  prototype public function setMultiline (ml : Boolean);
  prototype private function setPattern (val);
  prototype public function setResize (val : Boolean);
  prototype public function setScroll (s);
  prototype public function setSelectable (isSel : Boolean);
  prototype public function setSelection (start : Number, end : Number);
  prototype public function setText (t : String);
  prototype private function setWidth (val);
  prototype private function setWordWrap (wrap);
  prototype public function setXScroll (n : Number);
  prototype public function setYScroll (n : Number);
  prototype private function toString ();
  prototype private function __updatefieldsize ();
  prototype private function updateMaxLines ();
}