Is there a way to run a < play> command after an alert box has been dismissed?

thillsman 8 years ago updated 8 years ago 2
I'm working on a Tic Tac Toe app where an alert box tells who wins after a winning play has been made. I would like the alert box to pop up after the winning play (it does currently) and then clear the Xs and Os off the game board when a user dismisses the prompt. Here's what I have:

< if lhs="[var:cur1]" operator="e" rhs="[var:cur2]">
< if lhs="[var:cur1]" operator="e" rhs="[var:cur3]">
< alert title="You win!" message="[var:cur1] is the winner!" />
< play action="resetit" />
< /if>
< /if>

The "resetit" action runs concurrently with the alert. I've tried putting < sync> around the alert and play actions, but it works exactly the same. I know you can delay the sync, but delaying it for a set amount of time wouldn't be a very good user experience. Any tips?
In version 1.3 of the engine, we have made enhancements to the alert tag to allow for this. While this isn't quite out, it will be submitted and available soon.

When it does you will have some new attributes to rename the buttons in the alert and trigger actions when you select them.

Here is an example of how that will look:

<alert message="do you like beans?" buttononetitle="yes" buttononeaction="say-yes" buttontwotitle="no" buttontwoaction="say-no"/>

For now though we have less control over the dismissal of the alert button, so you could try using a sync block to throw your play action like you mentioned above, but move your alert to the end of the sync, that way your resetit action will fire and then the alert will display right after. Let me know if that works better for you?
Great. Thanks, Ian!