How do I loop in text objects?

Get help using Construct 2

Post » Thu May 01, 2014 3:03 pm

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
B
4
Posts: 3
Reputation: 206

Post » Thu May 01, 2014 4:07 pm

Instead of creating 50 different text objects You can create only one with instance variable to differentiate them.
ImageImageImageImage
B
157
S
66
G
41
Posts: 2,599
Reputation: 34,825

Post » Fri May 02, 2014 1:29 pm

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.
B
13
S
4
G
1
Posts: 107
Reputation: 1,337


Return to How do I....?

Who is online

Users browsing this forum: ChoosyZerk, dop2000, Lancifer and 53 guests