Hi,
There are two cards in this stack. Both cards have a script. There is no relevant script at stack level, unless a script in one of the two cards calls a script at stack level, but I don't think this is a the case. Therefore, I don't think that your observation is correct. Something must have confused you
The first card handles the next button. The second card handles the Prev button. (Apparently, the first card is called "Commands" and the second card is called "PrvNextButtons" but they could have any name you like). Therefore, you need two different sets of scripts and it makes sense to write these scripts at card level rather than stack level.
The two navigation buttons, and possibly all other controls too, are in a group because you need them on both cards. It is obvious.
The script of cd 1:
Code: Select all
on openCard
enable btn "Next"
end openCard
on closeCard
disable btn "Next"
end closeCard
The script of cd 2:
Code: Select all
on openCard
enable btn "Prev"
end openCard
on closeCard
disable btn "Prev"
end closeCard
The first card enables and disables the "Next" button. The second card enables and disables the "Prev" button. This makes sense.
If you have mutliple cards, it doesn't make sense to write these scripts at card level, because you don't want to have a script in every card if you can avoid it. The following script, written at stack level, is a much better alternative:
Code: Select all
on preOpenCard
if the number of this cd is 1 then
disable btn "Prev"
enable btn "Next"
else if the number of this cd is the number of cards then
enable btn "Prev"
disable btn "Next"
else
enable btn "Prev"
disable btn "Next"
end if
end preOpenCard
This last example is better, because you don't need to make sure that the first card always stays the first card and the last card always stays the last card. You can shuffle the cards at will and the script will still work correctly.
Kind regards,
Mark