How do I change a text on another layout

Get help using Construct 2

Post » Sat Mar 08, 2014 3:13 am

Hi, so I have 2 layouts, and one has a button on it and the second one has a text object on it.
I have an event that says "on click" of the button, "go to layout 2" and "set texto bject's text to 12345"
It goes to the layout, but the text never changes.
If I put the text object on the same layout as the button, it does work.

What am I missing ? It seems pretty straight forward, but...

Thanks
saludos :D
B
9
S
2
G
4
Posts: 19
Reputation: 2,648

Post » Sat Mar 08, 2014 3:26 am

You're having it go to another room and then trying to set text, which doesn't work. If you want to set a line of text in the next layout you'll have to do it with a global variable or set the line to change in the second layouts event sheet(again either with a global variable or hard coded).
B
17
S
2
G
6
Posts: 16
Reputation: 4,292

Post » Sat Mar 08, 2014 8:02 am

Make a global variable called "clicked" initial value=0
When button on layout1 is clicked,
-Set global variable "clicked" to 1
On start of layout2,
"Clicked" =1
-Set text to what ever.
I will not let you reach the sisters
Nature Forums
B
11
S
5
G
2
Posts: 496
Reputation: 2,306

Post » Sat Mar 08, 2014 5:29 pm

Oh, I will try that.
Why is it that an event triggered in a layout can't perform an action that changes an object on a different layout ?

Thanks
saludos :D
B
9
S
2
G
4
Posts: 19
Reputation: 2,648

Post » Sun Mar 09, 2014 8:49 am

Usually the event sheet in one layout does not affect the other.
I will not let you reach the sisters
Nature Forums
B
11
S
5
G
2
Posts: 496
Reputation: 2,306

Post » Sun Mar 09, 2014 4:51 pm

But you can still have 2 layouts share an event sheet, and events work on both layouts just fine.
The problem only appears when an object on one layout is the trigger and an object on another layout is affected by the action triggered.

saludos :D
B
9
S
2
G
4
Posts: 19
Reputation: 2,648

Post » Sun Mar 09, 2014 5:05 pm

AlexmosuTSP wrote:But you can still have 2 layouts share an event sheet, and events work on both layouts just fine.
The problem only appears when an object on one layout is the trigger and an object on another layout is affected by the action triggered.

saludos :D

You noticed well :o
:roll:
I will not let you reach the sisters
Nature Forums
B
11
S
5
G
2
Posts: 496
Reputation: 2,306

Post » Sun Mar 09, 2014 5:10 pm

AlexmosuTSP wrote:The problem only appears when an object on one layout is the trigger and an object on another layout is affected by the action triggered.

saludos :D

That's because a trigger event works just once.The actions in it are executed as soon as it triggers.
Think.......
I will not let you reach the sisters
Nature Forums
B
11
S
5
G
2
Posts: 496
Reputation: 2,306

Post » Sun Mar 09, 2014 5:38 pm

Still don't understand, if a click is the trigger , why does it matter if the text to be changed is on layout 1 or layout 2, as long as both sahre the same events sheet ?

saludos :D
B
9
S
2
G
4
Posts: 19
Reputation: 2,648

Post » Mon Mar 10, 2014 8:28 am

AlexmosuTSP wrote:Still don't understand, if a click is the trigger , why does it matter if the text to be changed is on layout 1 or layout 2, as long as both sahre the same events sheet ?

saludos :D

Have you tried that?(Both having the same layout?)
I will not let you reach the sisters
Nature Forums
B
11
S
5
G
2
Posts: 496
Reputation: 2,306

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 19 guests