Images revert when you get directed back to page

ATeator
ATeator Community Member Posts: 3 ☆ Roadie ☆

Hi everyone,

I'm hoping you can give me a hand here. I have a page with four images of doors. You click on a door, a key animates over to "unlock" the door. Then it brings you to a page that shows the contents behind the door. Then there is a click button that brings you back to the original page. My issue is I'd like some way of showing people have already opened the doors when they go back. I have tried a number of ways, but because you are actually brought back to the beginning of the page, everything resets. Has anyone else had this issue and does any one out there have a tip on how I can get this to work?

Thanks so much,

Angie Teator

Best Answer

  • andrew-robertson
    andrew-robertson Community Member Posts: 362 ♦ Idol ♦
    Answer ✓

    Easiest way in my eyes would be to have a variable that stores whether a door was opened/accessed. For example, create a variable called _OpenedDoors. Once a door is opened/clicked, it adds to the variable a letter corresponding to that door (for example, A for Door 1, B for Door 2, etc.), and then do an on-page load for that hotspot page to show the opened door image if _OpenedDoors contains a specific letter to show that open door.

    Let me write out the exact actions to do and put where.

    1. Create _OpenedDoors variable.
    2. Add 4 OnPageShow actions, each one with an If/Then that would check to see if a variable contains X (X being, A, B, C, or D). If the variable (_OpenedDoors) contains X, then show opened door image corresponding to that variable (A = 1, B = 2, C = 3, D = 4), otherwise show the door closed image.
    3. Add an action to the door button that, on mouse click, adds X to the variable (eg. Add A to the _OpenedDoor variable).
    4. Add an action to the door button that, on mouse click, take them to page that is supposed to open.

    Hopefully this makes sense.

    Andrew R.
    Developing content since 2010 using a mixed bag of tools.

Answers

  • ATeator
    ATeator Community Member Posts: 3 ☆ Roadie ☆

    Thank you! That makes so much sense! I did a variation of that for other pages, but it didn't occur to me here with adding the variable to the page to begin with. Then people can open the doors in any order and it will still function correctly. I really appreciate the quick response.

    Angie Teator

  • andrew-robertson
    andrew-robertson Community Member Posts: 362 ♦ Idol ♦

    You got it! Glad I was able to be your Engineering Duck! :) Quack Quack.

    Andrew R.
    Developing content since 2010 using a mixed bag of tools.