0
Beantwoord

Global Variables?

Pardesi Media 10 jaar geleden bijgewerkt door Inna Komarovsky 10 jaar geleden 1
Is there a way I can use define and later use global variables? I need user to select one of the three options on the menu page, and based on that selection want to display different images in the pages. I do not want to duplicate the page and create a different path, want to use the same pages, just based on the selected option display a different image (a character in the story). Thanks.

--
Adeel

Antwoord

Antwoord
Beantwoord
Hi Adeel,

On the page where the user chooses from the three options, add one invisible global counter, and set its value to a specific number depending on the choice. For example, if the user taps choice 1, set the counter to 1.

On the other pages, use conditions that depend on the global counter. For example, show image 1 on page load if the global counter's value is 1, show image 2 on page load if the global counter's value is 2, and so on.

It works similarly to letting the user select the language in which they want to view the app, as demonstrated here: Creating a Toggle for Narration, Language, etc.
Antwoord
Beantwoord
Hi Adeel,

On the page where the user chooses from the three options, add one invisible global counter, and set its value to a specific number depending on the choice. For example, if the user taps choice 1, set the counter to 1.

On the other pages, use conditions that depend on the global counter. For example, show image 1 on page load if the global counter's value is 1, show image 2 on page load if the global counter's value is 2, and so on.

It works similarly to letting the user select the language in which they want to view the app, as demonstrated here: Creating a Toggle for Narration, Language, etc.