Available since version 0.9.4.
Class | Extends |
---|---|
org.apache.royale.jewel.Label{:target=‘_blank’} | org.apache.royale.core.supportClasses.StyledImageBase{:target=‘_blank’} |
Note: This component is currently only available for JavaScript.
The Jewel Label implements the Jewel control for single and multi line text labels. It dispatches a click event when the user clicks over it.
In MXML declare a Label
like this:
<j:Label/>
In ActionScript we can do the same in the following way:
var label:Label = new Label(); parent.addElement(label);
where parent
is the container where the control will be added.
Here is an example of the default label:
code here{:target=‘_blank’}
Check the Reference of org.apache.royale.jewel.Label{:target=‘_blank’} for a more detailed list of properties and methods.
PROPERTY | Type | Description |
---|---|---|
text | String | The text inside the label. |
html | String | The html text inside the label. |
multiline | Boolean | false for single line. true for multiline. |
None.
The Label
has a click event of type org.apache.royale.events.Event{:target=‘_blank’}. This event is dispatched when the user clicks the control and triggers some action coded in a callback function. Programmatic changes will not trigger this event.
You can attach callback listeners to the click event in MXML as follows:
<j:Label click="clickHandler(event)"/>
the click event will use the clickHandler
callback function you provide in ActionScript:
<fx:Script> <![CDATA[ private function clickHandler(event:Event):void { trace("You clicked the label!"); } ]]> </fx:Script>
When the user clicks the label, the message “You clicked the label!” appears in the console log.
In ActionScript we can add an event handler this way:
var label:Label = new Label(); label.addEventListener('click', clickHandler); parent.addElement(label);
Unlike other components in Royale, the Jewel Label
does not have beads for View pr Controller in the JavaScript platform, but has Model.
Bead Type | Implementation | Description |
---|---|---|
IBeadModel{:target=‘_blank’} | org.apache.royale.jewel.beads.models.TextModel{:target=‘_blank’} | The data model for the Label. |
Jewel does not have beads specially crafted for this control, but it can use other common Jewel control beads (shared with other controls) to provide more functionality.
None
Bead Type | Implementation | Description |
---|---|---|
Disabled{:target=‘_blank’} | org.apache.royale.core.IBead{:target=‘_blank’} | This bead lets you disable and enable a Jewel control. |
SizeControl{:target=‘_blank’} | org.apache.royale.core.IBead{:target=‘_blank’} | Add this bead to give the Jewel control a custom size. |
ToolTip{:target=‘_blank’} | org.apache.royale.core.IBead{:target=‘_blank’} | Add this bead to enable floating a text string over the control when the user hovers the mouse cursor over it. |