How do I loop in text objects?

  • Hi there,

    i have a screen, like a paytable, that i need to fullfill with an xml result. The ideal, for me, is loop through the xml nodes and dinamically add the value to the text field.

    So i have a text object named "text_1_1", then "text_1_2" and so on. Is it possible to create the text objects dinamically and then assign coordinates and values, or i HAVE to create 50 text objects and then add 50 actions to fill them with the right xml node value?

    Thanks!

    Cris

  • Instead of creating 50 different text objects You can create only one with instance variable to differentiate them.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Just create one text object and set the properties, variables, etc.

    On Start of Layout (System) destroy this object. (optimal)

    Then you can create it everywhere you want in a for-loop. (one tick).

    If you want to update the content of them, just destroy and create again.

    On the for loop event:

    • create a text object
    • set the text of your xml node. etc.

    OR: You can create the text object once and store their UIDs in a Array. So you can call it by "pick by unique id". And set the text.

    ... the xml case is your part.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)