#1

1 messages · Page 1 of 1 (latest)

stone crystal
#

how to make it so that after clicking a button, a certain image/text disappears and another image/text appears - something like pages, etc

unborn gazelleBOT
# stone crystal how to make it so that after clicking a button, a certain image/text disappears ...

Hello there! 👋

You're looking to create a paginated system where clicking a button hides some elements and shows others. You can achieve this using FancyMenu's variable system and loading requirements.

Here's a concise guide on how to set it up:

  1. Create a Variable:

    • Go to Customization -> Variables -> Manage Variables from the menu bar.
    • Add a new variable (e.g., currentPage) and set its initial value (e.g., 1).
  2. Configure Your Elements (Images/Text):

    • For Page 1 Elements: Right-click the element in the editor, go to Loading Requirements, and add an "Is Variable Value" requirement. Set it to check if your currentPage variable equals 1.
    • For Page 2 Elements: Repeat the above steps, but set the requirement to check if currentPage equals 2.
    • Continue this for all your pages.
  3. Set Up Navigation Buttons:

    • "Next Page" Button:
      • Right-click the button and select Edit Action Script.
      • Add an IF Statement to check if currentPage is the last page (e.g., if currentPage == 2). If it is, set currentPage back to 1.
      • ELSE, add an action to increment the currentPage variable (e.g., currentPage:{"placeholder":"calc","values":{"expression":"{"placeholder":"getvariable","values":{"name":"currentPage"}} + 1"}}).
    • "Previous Page" Button:
      • Similar to the "Next Page" button, but decrement currentPage and handle the case if currentPage is 1.

This way, when a button is clicked, the currentPage variable updates, and FancyMenu automatically hides/shows elements based on their loading requirements.

stone crystal
#

I have made the visibility requirements for the page=2 elements, how do I make the variable change its value when I click the button