blob: 34d4633df6d41075ac3c7cd61658c69bb7c44e17 [file] [log] [blame]
{ "type": "class",
"qname": "mx.controls.Label",
"baseClassname": "mx.core.UIComponent"
,
"description": "The Label control displays a single line of noneditable text. Use the Text control to create blocks of multiline noneditable text. <p>You can format Label text by using HTML tags, which are applied after the Label control's CSS styles are applied. You can also put padding around the four sides of the text. The text of a Label is nonselectable by default, but you can make it selectable.</p> <p>If a Label is sized to be smaller than its text, you can control whether the text is simply clipped or whether it is truncated with a localizable string such as &quot;...&quot;. (Note: Plain text can be truncated, but HTML text cannot.) If the entire text of the Label, either plain or HTML, is not completely visible, and you haven't assigned a tooltip to the Label, an automatic &quot;truncation tip&quot; displays the complete plain text when a user holds the mouse over the Label control.</p> <p>Label controls do not have backgrounds or borders and cannot take focus.</p> <p>The Label control has the following default sizing characteristics:</p> <table class=&quot;innertable&quot;> <tr> <th>Characteristic</th> <th>Description</th> </tr> <tr> <td>Default size</td> <td>Width and height large enough for the text</td> </tr> <tr> <td>Minimum size</td> <td>0 pixels</td> </tr> <tr> <td>Maximum size</td> <td>10000 by 10000 pixels</td> </tr> </table> <p>The <code>&lt;mx:Label&gt;</code> tag inherits all of the tag attributes of its superclass, and adds the following tag attributes:</p> <pre>\\n &lt;mx:Label\\n <b>Properties</b>\\n condenseWhite=&quot;true|false&quot;\\n data=&quot;null&quot;\\n htmlText=&quot;&quot;\\n listData=&quot;null&quot;\\n selectable=&quot;true|false&quot;\\n text=&quot;&quot;\\n truncateToFit=&quot;true|false&quot;\\n &nbsp;\\n <b>Styles</b>\\n color=&quot;0x0B333C&quot;\\n disabledColor=&quot;0xAAB3B3&quot;\\n fontAntiAliasType=&quot;advanced|normal&quot;\\n fontFamily=&quot;Verdana&quot;\\n fontGridFitType=&quot;pixel|none|subpixel&quot;\\n fontSharpness=&quot;0&quot;\\n fontSize=&quot;10&quot;\\n fontStyle=&quot;normal|italic&quot;\\n fontThickness=&quot;0&quot;\\n fontWeight=&quot;normal|bold&quot;\\n paddingLeft=&quot;0&quot;\\n paddingRight=&quot;0&quot;\\n paddingTop=&quot;0&quot;\\n paddingBottom=&quot;0&quot;\\n styleSheet=&quot;null&quot;\\n textAlign=&quot;left|right|center&quot;\\n textDecoration=&quot;none|underline&quot;\\n textIndent=&quot;0&quot;\\n &nbsp;\\n <b>Events</b>\\n dataChange=&quot;<i>No default</i>&quot;\\n /&gt;\\n </pre>",
"tags": [
{ "tagName": "includeExample",
"values": ["examples/LabelExample.mxml"]},
{ "tagName": "see",
"values": ["mx.controls.Text", "mx.controls.TextInput", "mx.controls.TextArea", "mx.controls.RichTextEditor"]},
{ "tagName": "mxml",
"values": []},
{ "tagName": "playerversion",
"values": ["Flash 9", "AIR 1.1"]},
{ "tagName": "productversion",
"values": ["Flex 3"]},
{ "tagName": "langversion",
"values": ["3.0"]} ],
"members": [
{ "type": "method",
"qname": "mx.controls.Label",
"namespace": "",
"bindable": [],
"details": [],
"deprecated": {},
"description": "Constructor.",
"tags": [
{ "tagName": "playerversion",
"values": ["Flash 9", "AIR 1.1"]},
{ "tagName": "productversion",
"values": ["Flex 3"]},
{ "tagName": "langversion",
"values": ["3.0"]} ],
"return": "",
"params": []}
,
{ "type": "accessor",
"access": "read-write",
"return": "Boolean",
"qname": "enabled",
"namespace": "public",
"bindable": [],
"details": ["override"],
"deprecated": {},
"description": "",
"tags": [
{ "tagName": "playerversion",
"values": ["Flash 9", "AIR 1.1", "Flash 9", "AIR 1.1", "Flash 9", "AIR 1.1"]},
{ "tagName": "copy",
"values": ["mx.core.IUIComponent#enabled", "mx.core.IUIComponent#enabled", "mx.core.IUIComponent#enabled"]},
{ "tagName": "productversion",
"values": ["Flex 3", "Flex 3", "Flex 3"]},
{ "tagName": "langversion",
"values": ["3.0", "3.0", "3.0"]} ]},
{ "type": "accessor",
"access": "read-write",
"return": "Boolean",
"qname": "selectable",
"namespace": "public",
"bindable": [],
"details": [],
"deprecated": {},
"description": "Specifies whether the text can be selected. Making the text selectable lets you copy text from the control. <p>When a <code>link</code> event is specified in the Label control, the <code>selectable</code> property must be set to <code>true</code> to execute the <code>link</code> event.</p>",
"tags": [
{ "tagName": "default",
"values": ["false;"]},
{ "tagName": "playerversion",
"values": ["Flash 9", "AIR 1.1"]},
{ "tagName": "productversion",
"values": ["Flex 3"]},
{ "tagName": "langversion",
"values": ["3.0"]} ]},
{ "type": "accessor",
"access": "read-write",
"return": "Object",
"qname": "data",
"namespace": "public",
"bindable": ["dataChange"],
"details": [],
"deprecated": {},
"description": "Lets you pass a value to the component when you use it in an item renderer or item editor. You typically use data binding to bind a field of the <code>data</code> property to a property of this component. <p>When you use the control as a drop-in item renderer or drop-in item editor, Flex automatically writes the current value of the item to the <code>text</code> property of this control.</p> <p>You do not set this property in MXML.</p>",
"tags": [
{ "tagName": "default",
"values": ["null"]},
{ "tagName": "see",
"values": ["mx.core.IDataRenderer"]},
{ "tagName": "playerversion",
"values": ["Flash 9", "AIR 1.1"]},
{ "tagName": "productversion",
"values": ["Flex 3"]},
{ "tagName": "langversion",
"values": ["3.0"]} ]},
{ "type": "accessor",
"access": "read-write",
"return": "Object",
"qname": "listData",
"namespace": "public",
"bindable": ["__NoChangeEvent__"],
"details": [],
"deprecated": {},
"description": "Additional data about the list structure the itemRenderer may find useful.",
"tags": [
{ "tagName": "playerversion",
"values": ["Flash 10.2", "AIR 2.6"]},
{ "tagName": "productversion",
"values": ["Royale 0.0"]},
{ "tagName": "langversion",
"values": ["3.0"]} ]},
{ "type": "accessor",
"access": "read-write",
"return": "String",
"qname": "htmlText",
"namespace": "public",
"bindable": ["htmlChange"],
"details": [],
"deprecated": {},
"description": "Specifies the text displayed by the Label control, including HTML markup that expresses the styles of that text. When you specify HTML text in this property, you can use the subset of HTML tags that is supported by the Flash TextField control. <p>When you set this property, the HTML markup is applied after the CSS styles for the Label instance are applied. When you get this property, the HTML markup includes the CSS styles.</p> <p>For example, if you set this to be a string such as, <code>&quot;This is an example of &lt;b&gt;bold&lt;/b&gt; markup&quot;</code>, the text &quot;This is an example of <b>bold</b> markup&quot; appears in the Label with whatever CSS styles normally apply. Also, the word &quot;bold&quot; appears in boldface font because of the <code>&lt;b&gt;</code> markup.</p> <p>HTML markup uses characters such as &lt; and &gt;, which have special meaning in XML (and therefore in MXML). So, code such as the following does not compile:</p> <pre>\\n &lt;mx:Label htmlText=&quot;This is an example of &lt;b&gt;bold&lt;/b&gt; markup&quot;/&gt;\\n </pre> <p>There are three ways around this problem.</p> <ul> <li> <p>Set the <code>htmlText</code> property in an ActionScript method called as an <code>initialize</code> handler:</p> <pre>\\n &lt;mx:Label id=&quot;myLabel&quot; initialize=&quot;myLabel_initialize()&quot;/&gt;\\n </pre> <p>where the <code>myLabel_initialize</code> method is in a script CDATA section:</p> <pre>\\n &lt;fx:Script&gt;\\n &lt;![CDATA[\\n private function myLabel_initialize():void {\\n myLabel.htmlText = &quot;This is an example of &lt;b&gt;bold&lt;/b&gt; markup&quot;;\\n }\\n ]]&gt;\\n &lt;/fx:Script&gt;\\n \\n </pre> <p>This is the simplest approach because the HTML markup remains easily readable. Notice that you must assign an <code>id</code> to the label so you can refer to it in the <code>initialize</code> handler.</p> </li> <li> <p>Specify the <code>htmlText</code> property by using a child tag with a CDATA section. A CDATA section in XML contains character data where characters like &lt; and &gt; aren't given a special meaning.</p> <pre>\\n &lt;mx:Label&gt;\\n &lt;mx:htmlText&gt;&lt;![CDATA[This is an example of &lt;b&gt;bold&lt;/b&gt; markup]]&gt;&lt;/mx:htmlText&gt;\\n &lt;mx:Label/&gt;\\n </pre> <p>You must write the <code>htmlText</code> property as a child tag rather than as an attribute on the <code>&lt;mx:Label&gt;</code> tag because XML doesn't allow CDATA for the value of an attribute. Notice that the markup is readable, but the CDATA section makes this approach more complicated.</p> </li> <li> <p>Use an <code>hmtlText</code> attribute where any occurences of the HTML markup characters &lt; and &gt; in the attribute value are written instead as the XML &quot;entities&quot; <code>&amp;lt;</code> and <code>&amp;gt;</code>:</p> <pre>\\n &lt;mx:Label htmlText=&quot;This is an example of &amp;lt;b&amp;gt;bold&amp;lt;/b&amp;gt; markup&quot;/&amp;gt;\\n </pre> Adobe does not recommend this approach because the HTML markup becomes nearly impossible to read. </li> </ul> <p>If the <code>condenseWhite</code> property is <code>true</code> when you set the <code>htmlText</code> property, multiple white-space characters are condensed, as in HTML-based browsers; for example, three consecutive spaces are displayed as a single space. The default value for <code>condenseWhite</code> is <code>false</code>, so you must set <code>condenseWhite</code> to <code>true</code> to collapse the white space.</p> <p>If you read back the <code>htmlText</code> property quickly after setting it, you get the same string that you set. However, after the LayoutManager runs, the value changes to include additional markup that includes the CSS styles.</p> <p>Setting the <code>htmlText</code> property affects the <code>text</code> property in several ways. If you read the <code>text</code> property quickly after setting the <code>htmlText</code> property, you get <code>null</code>, which indicates that the <code>text</code> corresponding to the new <code>htmlText</code> has not yet been determined. However, after the LayoutManager runs, the <code>text</code> property value changes to the <code>htmlText</code> string with all the HTML markup removed; that is, the value is the characters that the Label actually displays.</p> <p>Conversely, if you set the <code>text</code> property, any previously set <code>htmlText</code> is irrelevant. If you read the <code>htmlText</code> property quickly after setting the <code>text</code> property, you get <code>null</code>, which indicates that the <code>htmlText</code> that corresponds to the new <code>text</code> has not yet been determined. However, after the LayoutManager runs, the <code>htmlText</code> property value changes to the new text plus the HTML markup for the CSS styles.</p> <p>To make the LayoutManager run immediately, you can call the <code>validateNow()</code> method on the Label. For example, you could set some <code>htmlText</code>, call the <code>validateNow()</code> method, and immediately obtain the corresponding <code>text</code> that doesn't have the HTML markup.</p> <p>If you set both <code>text</code> and <code>htmlText</code> properties in ActionScript, whichever is set last takes effect. Do not set both in MXML, because MXML does not guarantee that the properties of an instance get set in any particular order.</p> <p>Setting either <code>text</code> or <code>htmlText</code> property inside a loop is a fast operation, because the underlying TextField that actually renders the text is not updated until the LayoutManager runs.</p> <p>If you try to set this property to <code>null</code>, it is set, instead, to the empty string. If the property temporarily has the value <code>null</code>, it indicates that the <code>text</code> has been recently set and the corresponding <code>htmlText</code> has not yet been determined.</p>",
"tags": [
{ "tagName": "default",
"values": [""""]},
{ "tagName": "see",
"values": ["flash.text.TextField#htmlText"]},
{ "tagName": "playerversion",
"values": ["Flash 9", "AIR 1.1"]},
{ "tagName": "productversion",
"values": ["Flex 3"]},
{ "tagName": "langversion",
"values": ["3.0"]} ]},
{ "type": "field",
"qname": "textNode",
"return": "Text",
"namespace": "protected",
"bindable": [],
"details": [],
"deprecated": {}},
{ "type": "accessor",
"access": "read-write",
"return": "String",
"qname": "text",
"namespace": "public",
"bindable": ["textChange"],
"details": [],
"deprecated": {},
"description": "The text to display in the label.",
"tags": [
{ "tagName": "playerversion",
"values": ["Flash 10.2", "AIR 2.6"]},
{ "tagName": "productversion",
"values": ["Royale 0.0"]},
{ "tagName": "langversion",
"values": ["3.0"]} ]},
{ "type": "method",
"qname": "createElement",
"namespace": "protected",
"bindable": [],
"details": ["override"],
"deprecated": {},
"description": "",
"tags": [
{ "tagName": "royaleignorecoercion",
"values": ["window.Text"]} ],
"return": "org.apache.royale.core.WrappedHTMLElement",
"params": []}
]
,
"events": [
{ "qname": "dataChange",
"type": "mx.events.FlexEvent"
,
"description": "Dispatched when the <code>data</code> property changes. <p>When you use a component as an item renderer, the <code>data</code> property contains the data to display. You can listen for this event and update the component when the <code>data</code> property changes.</p>",
"tags": [
{ "tagName": "playerversion",
"values": ["Flash 9", "AIR 1.1"]},
{ "tagName": "eventType",
"values": ["mx.events.FlexEvent.DATA_CHANGE"]},
{ "tagName": "productversion",
"values": ["Flex 3"]},
{ "tagName": "langversion",
"values": ["3.0"]} ]},
{ "qname": "click",
"type": "mx.events.MouseEvent"
,
"description": "Dispatched when the user clicks on a Label.",
"tags": [
{ "tagName": "playerversion",
"values": ["Flash 10.2", "AIR 2.6"]},
{ "tagName": "productversion",
"values": ["Royale 0.9.0"]},
{ "tagName": "langversion",
"values": ["3.0"]} ]}]
}