Strictly speaking, the uiLabel component is not a UI control - it is not focusable and the user does not interact with the component. It is used to display text alongside an image. Use the uiText instead if you want to display text only. Likewise, the uiImage class should be used if you just want to display an image.
import com.ghostwire.ui.containers.uiBox; import com.ghostwire.ui.containers.uiForm; import com.ghostwire.ui.controls.uiLabel; import com.ghostwire.ui.controls.uiPushButton; import com.ghostwire.ui.controls.uiTextInput; import com.ghostwire.ui.enums.ALIGN; // ** label ** var passLabel:uiLabel = new uiLabel("Password","alert.png"); passLabel.alignY = ALIGN.CENTER; // ** text input ** var passInput:uiTextInput = new uiTextInput(); passInput.alignY = ALIGN.CENTER; passInput.displayAsPassword = true; // ** push button ** var passBtn:uiPushButton = new uiPushButton("Submit"); passBtn.alignY = ALIGN.CENTER; // ** box layout container ** var passBox:uiBox = new uiBox(); passBox.spacing = 10; passBox.addChild(passLabel); passBox.addChild(passInput); passBox.addChild(passBtn); // ** top level form container ** var passForm:uiForm = new uiForm(); passForm.defaultButton = passBtn; passForm.addChild(passBox); // ** add to display list ** addChild(passForm);
By default, the text is positioned to the right of the image. You can change this setting via the textPosition property. Qualified values for the textPosition property are POSITION.BOTTOM, POSITION.LEFT, POSITION.RIGHT, and POSITION.TOP1).
passLabel.textPosition = POSITION.BOTTOM;
The uiLabel component is actually a composite embedding a uiImage instance and a uiText instance. You can access these embedded uiImage and uiText instances via the properties uiimage and uitext respectively.
For more information on the members of the com.ghostwire.ui.controls.uiLabel class, please refer to the API Reference.
com.ghostwire.ui.enums.POSITION