There are several ways you could approach this. Here's one:
-- stack script ----------------------------------------
on openStack
-- ask the user if they want manual or auto advance
answer "Which way?" with "Manual" or "Auto"
if it is "Auto"
then insert the script of btn "auto" into back
else insert the script of btn "manual" into back
end openStack
on openCard
send "startSound" to this card
send "autoAdvance" to this card
end openCard
-- script of btn "auto" (hidden on card 1) -------------
on startSound
play audioClip (short name of this card)
end startSound
on autoAdvance
if the sound is "done"
then go next card
else send "autoAdvance" to this card
end autoAdvance
-- script of btn "manual" (hidden on card 1) -------------
on startSound
-- trap message and do nothing
end startSound
on autoAdvance
-- trap message and do nothing
end autoAdvance
DISCLAIMER: This code is completely untested.
>
>I have just started working on this, so it may not be fair to ask for
>input yet:-)
>but I thought that some of you may have done similar things and might be
>able to save me some time.
>
>I know the "sound" property allows me to check whether audio is playing,
>but I haven't quite worked out the syntax yet. Also, I assume that I
>should be able to set a variable depending on the user selection regarding
>auto page turn. However, it seems to me that a standard global variable
>only remains active within a single script (I could be wrong), so I'm not
>sure how to set a global variable throughout a stack.
Just declare the global in any handler where you want to use it - the
value will remain the same from one use to the next (within a given
MetaCard session - from program launch to program exit).
on openCard
doFirst
doSecond
end openCard
on doFirst
global gName
put "Wayne" into gName
end doFirst
on doSecond
global gName
answer gName -- will display "Wayne" in the dialog
end doSecond
>
>Enough questions. Thank you!
>
>Wayne
>
Phil Davis
--------------------------------------
ideaguy@imagina.com (503) 557-5656