I am just new in livecode. I created a back button and added below code on on mouseup
event. I put the back button inside the Card 5
. On Card 1
, I have code that will go to Card 5
.
The problem is, when I press the back button in Card 5, it always goes to Card 4
. Is this the correct behavior? I was thinking if it should goes to Card 1
which is the previous card. Is there another way to do this?
Thanks for the help.
Code:
go to the previous card
Cards:
Card 1 Card 2 Card 3 Card 4 Card 5
UPDATE:
I have managed to fix my own problem. I created a global variable to store the previous card name and use this line of code go to card "previous card name"
. But if anybody else have better solution, that would be great.
The recent keyword will do what you are looking for. Each time you navigate to a card it is added to the 'recent' list, so…
go to the recent card
…will step back through the recently visited cards, much like the back button on a browser.
This can be shortened to…
go recent
Then to move forward again through the 'recent' list, use…
go forward
Note that both forward and recent cycle through the recent list, so if the list only contains 1, 2 & 3 then when you go forward and reach card 3, the next forward command will take you to 1.