The label text

Hello

I have labels, label1, label2, label3... label11.

I want to change their texts,

The code below does not work, can someone tell me how to change the text using the loop?

public void init (): void
{
for (var i: Number = 0; i < = 10; i ++)
{
var str:String = "label" + i;

Str.Text = i;
}
}

Thank you

Hello

The reason why this does not work is that str is simply a variable of type String, it is not actually point to the label controls even if they have the chance to have the same id as the value of str.  One way to do would be to put all label controls in a table and a loop in the table:

public var labels:Array = new Array();

...add all your labels to the array

for(var i:int = 0; i < labels.length; i++)
{
     labels[i].text = i;
}

I'm sure there are other ways to do it, but I think it looks the most like what you're trying to do in your example.

See you soon

Tags: Flex

Similar Questions

  • How to change the label text in the search form?

    Hi all!
    JDev 11g ADFBC

    How to change the label text in the search form?

    Yes, I use af:query

    It would be based on a ViewCriteria in your VO. The labels on the request form are the same that you set in your advice to display attribute in the VO

  • OnImmediateValueChanged cursor does not update the label text by dragging.

    Consider the following:

    Container {
            layout: DockLayout {}
            Label {
                id: label
                textStyle.base: SystemDefaults.TextStyles.BigText
                verticalAlignment: VerticalAlignment.Center
                horizontalAlignment: HorizontalAlignment.Center
            }
    
            Slider {
                fromValue: 0
                toValue: 59
                value: 0
                 onImmediateValueChanged: {
                     label.text = value;
                 }
            }
        }
    

    When you drag the cursor, it does not update the text of the label smoothly. How can I achieve this?

    Found the solution!

    By mistake I used the value parameter and not immediateValue in the onImmediateValueChanged function!

  • The label text of discoloration

    Someone at - it notificed that the last bit of the text in a label has applied discoloration?

    I'm trying to disable because sometimes it can make the text difficult to read.

    He comes to taking BlackBerry selection button used on other platforms.

    If you want to adjust the text of the label, you can use textFit...

    http://developer.BlackBerry.com/native/reference/Cascades/bb__cascades__label.html#property-TextFit

  • Center (bb10) vertically on the label text

    Hi guys!

    Is there a way to vertically Center the text on the label?

    Suppose you have a label with heithg = 200 and I want to Center vertically.

    Is this possible?

    I think that there is no such thing as a valign, or almost, but if you set the height of the label on the actual height of the text you can then focus on it vertically by applying equal and the margin down (if you use layoutData) or something like

    myLabel.y = (availableHeight - myLabel.height) / 2...

    Note that you can not get the height of the text until the label is rendered or less placed in the display list (otherwise, it returns 0)

    myLabel.validateNow();
    myLabel.height = myLabel.textHeight;
    

    My app: Get set - get up!   Get ready for the revolution snooze.

  • Align to right the label text

    How to make the text inside the right side of the label aligned using c ++

    #include 
    #include 
    #include 
    
    using namespace bb::cascades;
    
    ...
    
    TextStyle rightAlignedStyle(SystemDefaults::TextStyles::bodyText());
    rightAlignedStyle.setTextAlign(TextAlign::Right);
    
    ...
    
    Label *label = Label::create()
            .textStyle(rightAlignedStyle);
    
    or
    
    label->setTextStyle(rightAlignedStyle);
    
  • How to display the required icon after the label text?

    Hello

    I use JDeveloper 11.1.1.4.

    My scenario is I < af:inputtext > with the required property = 'true '.

    Label look like,

    "* Name but I want to show as name *. . I want to show the * icon after the text of the label.

    How to achieve this in ADF...?



    Thank you...

    Hello, t..

    Yes, it is possible.

    In '', add the "styleClass" attribute For example:

    In the css file, add a new style class as follows:

    duration .requiredField

    {

    visibility: hidden;

    }

    Thank you.

    RFH.

  • Definition of results of the label text of the indication in the ComboBox control does not

    Hi all

    I created a form of table ADF Swing. Then, in a tab of the properties of the attributes of the dialog editor of Table Bindning, I put one of the fields as a ComboBox Editor.

    When the form is lance everything is ok - this field drop downs combobox with data from another VO.

    But when I put text field of the label of the tab to control EO or VO indicators stops ComboBox works - it works as if it was default editor - textfield, i.e. it displays the value of a base table.

    The following approach is not good, but in any case, I would like to note that when I change an attribute value 'name' of the 'AttrProp' tag to that of I put in the text field of the label of the EO (the ' label'):

    <? XML version = "1.0" encoding = "UTF-8"? >
    < pageDefinition...
    ...
    < links >
    < table...
    ...
    < AttrProp name = "Label" >
    ...
    < / pageDefinition >

    at the launch of the form everything starts working again, but when I try to change this field by just clicking the value/text field the following exception is thrown:
    oracle.jbo.NoDefException: Houston-25058: definition of Curr type attribute in SomeView1 not found.

    I use JDeveloper 10.1.3.3.0 (Build JDEVADF_10.1.3.3.0_NT_070619.1129.4157), ADF - 10.1.3.41.57 business components.

    Can I kindly ask someone to address the issue?

    Thank you
    Yerzhan.

    Published by: yerzhant on 06.01.2009 01:51

    Hello

    This seems to be a bug

    Frank

  • remove the label text border control

    How to remove the border around the text of a control label?

    Thank you...

    Go to the tools Palette and select paint labels made Transperant once for a single label, you can just click on other labels to make transperant.

  • Call functions of the label text

    I have a text that contains the names of user ("@username") and hastags ("#hashtag") and I want to run a function when one is clicked, like Twitter when you click on a username, it opens the profile page.

    I'm currently divide the text to another label every time that a user name or the hastag is found and adding a handler to tap.

    Is there another way to do it?

    Are you trying to let the user invoke Twitter itself, or have your own custom behavior?

    You can take a look at the ActiveTextHander: https://developer.blackberry.com/native/reference/cascades/bb__cascades__activetexthandler.html

  • Favicons repeat through tabs, behind the label text when you switch between tabs. 37.0.1 sometimes the Green scroll bar does not have too

    Please mention the attached JPEGS. When I switch between tabs, favicon image repeated behind the text. In some cases, the image of the vertical scrollbar is messed up, it cleared up when I click on it. -Does not appear to affect performance, simply annoying. Thank you!

    Please temporarily disable your Avast extension to see if it has to do with it.

    Try Firefox Mode without failure:

    Try Firefox Safe mode to see if the problem goes away. Firefox Safe mode is a troubleshooting mode that temporarily disables hardware acceleration, restores some settings and disables add-ons (extensions and themes).

    If Firefox is open, you can restart Firefox Safe mode in the Help menu:

    • Click the menu button

      click Help

      then select restart with disabled modules.

    If Firefox does not work, you can start Firefox in Mode safe as follows:

    • On Windows: Hold down the SHIFT key when you open the desktop Firefox or shortcut in the start menu.
    • On Mac: Hold the option key during the startup of Firefox.
    • On Linux: Exit Firefox, go to your Terminal and run firefox-safe-mode
      (you may need to specify the installation path of Firefox for example/usr/lib/firefox)

    When the Firefox Safe Mode window appears, select "start mode safe."

    If the problem is not present in Firefox Safe Mode, your problem is probably caused by an extension, theme or hardware acceleration. Please follow the steps described in the section Troubleshooting extensions, themes and problems of hardware acceleration to resolve common Firefox problems to find the cause.

    To exit safe mode of Firefox, simply close Firefox and wait a few seconds before you open Firefox for normal use again.

    When find you what is causing your problems, please let us know. This might help others with the same problem.

  • CHANGE the LABEL text

    Hello
    I have the forms 'FORM1' and 'FORM2. FORM1 is LOGIN PAGE... I want that 'when the connection of the user, the next page show username in the corner.
    so the Question is
    1. how to pass parameter to the next page... FORM2
    2 FORM2 have TEXT (not text element) which is empty... I want that when the form2 get the setting of form1 is the USER NAME, I want to write about TEXT NOTE: (NAME TEXT IS "" USER"")...

    concerning
    Sajid

    Hello

    Declare a global variable

    :global.user_name := :.;
    
    Create a text item in your form 2 and write in when-new-form-instance of form 2
    
    :. := :global.user_name
    

    You cannot change the name of the text.

    It will be useful.

    Check the answer as useful / OK, if this can help you

    Carole

  • Large label text is the default

    When I add a control or indicator of the FP, the label text is large by default.

    It wasn't like this before. How can I reset the default text size?

    Tools/Options/Environment/Fonts

    And check the drop-down list of fonts

  • How to set the text of the label from a point of view to another view?

    Hello

    I have two view view home and view header.

    House view contains the list of values.

    To the poster of the header, there is Label which is a title of this provision.

    When the user click on any value in home view I want to delegate control of the header display and to set the label text of selected line as heding on the display of the header.

    First if these two finds are two page qml distinct or unique. If they are saparete pages then you must use a data model to fill the list with data. Now on the selection of a row of list

    set the property in your House like this

    property variant selectedData
    

    now onTriggered signal write this code

    selectedData = dataModel.data(indexPath)
    

    and next page push, who do you think header, you can use this property value and fetch selectedData to display header

    as

    Label{
    
    text: selectedData.title
    }
    

    and if you have only the page containing the two views

    Follow the same steps

    and in this case, ontriggered signal set the label text

    Hope this can help you

  • Cluster containing the label the button Get?

    In view of the reference to a button in a cluster control, how can I get the label of the cluster containing (parent)?

    More information on the task at hand:

    I have a pair of buttons ('read' and 'write') within a cluster, what I repeated in rows and then wrapped in another cluster for convenience of layout. I now want to manage the events of each button, grouped by lines and columns, as in the photo (also attached VI):

    My goal is to have a case of "read" event and one case of event "write", and according to what rank button is pressed, the code will be the index of an array of data for reading and writing. I know I could write separate events for each, or change the labels for each button to "Read button 0", ' Read button 1 "," read "button 2", but this is just an illustrative example for a much larger grid of buttons and other controls, and it is prohibitively expensive to turn on each of the labels, modify them, and then hide each of the labels.»»

    If this is not possible, I am open to other ways to address this problem that don't involve not copy paste cases of event for each line (since it is also prohibitive for the frequency at which cases are changed).

    Thanks in advance,

    Arthur

    You can use the node property of the object button called "holder".  What it does is return a reference to the object owner of this button, in this case the cluster.  Then you can convert this reference to a more specific class of the cluster.  Then use a property node to read the label.text.

Maybe you are looking for