How do I use fewer events?

Just started using Construct 2? Post your questions here

Post » Thu Mar 05, 2015 11:48 am

Usually I'm able to find the solution to a problem by looking through the manual or browsing the forums but I haven't been able to find the right answer this time. Or maybe I've been looking in the wrong places. Or just not understood!

I use a button,an array, text object, and browser URL action. You click a button and it chooses a random array value. The text object displays whatever text is stored with each array value on x. So 0:'a' 1:'b' etc. Which is then linked to a URL action which, if you tap on the text, opens a different URL depending on the text. So if the text is 'a' it opens 'google', if the text is 'b' it opens 'yahoo' etc. I use a separate event for each 'compare text, open URL', is there a better way to do it? Otherwise I'm eventually going to end up with 1000's, maybe even 10,000+ events.

Posts: 1
Reputation: 327

Post » Thu Mar 05, 2015 3:24 pm

You could make your array a 2 dimension array and store the web address you want to link to in the second dimension like the following:

___| a | |
Y__| b | |
___| c ||


This way you only have to reference the array to get both the text to display and the link to use.
Posts: 331
Reputation: 7,767

Return to Beginner's Questions

Who is online

Users browsing this forum: mounikadoddla and 1 guest