How do I use "for each item in list"

My code is as follows:
When Screen2 .Initialize
do: for each buttontext in list: make a list: [button1 .text, button2 .text]
set buttontext to "hello"

I thought upon Screen2 initializing, the text for buttons button1 and button2 would be "hello" but they are not; the text for the buttons is the same as the text I entered in the designer section. Is it possible to use "for each item in list" to set the texts for several buttons to "hello"? What am I doing wrong?

Almost anything is possible ...

What am I doing wrong?

I don't know. I don't have a witch glass ball. :grin:
It's impossible to guess what you are doing wrong without seeing the aia file.

Try something like this

2 Likes