Page: http://wiki.cocoondev.org/Wiki.jsp?page=GettingStartedWithFlow , version:
28 on Tue Apr 29 08:02:06 2003 by TonyCollen
+ We are now back in the Javascript at the line after {{sendPageAndWait()}}.
We create a new variable (an int), which we get from the POST request that was
sent by the form. Notice in the form we had {{<input type="text"
name="guess"/>}} and in the Javascript we get the request parameter by using
{{cocoon.request.get("guess");}}
+ ''TODO: Explain all the objects available in the Flow layer. -- [TonyCollen]''
+
+ Now we increment the player's guess count, and we test to see if they guessed
the correct number. If the guess was too high, we set the hint variable
telling them to guess lower, and we fall through the bottom of the {{while}}
loop, and we send the guess form back to the player.
+
+ If the guess was too low, we tell them to guess higher, and we fall through
the loop as well, sending the player the form again.
+
+ If the guess was correct, we {{break}} out of the main loop and send the
player to a different view, this time to "{{success.jxt}}", and we give the
template not only their number and the random number (pointless, yes, because
they were the same), but also the number of guesses to tell the player how good
or bad at guessing numbers they are.
+
+ The main point of interest in the Flow script at this point is the use of
{{sendPage()}} instead of {{sendPageAndWait()}}. {{sendPage()}} works exactly
the same, except, yes, you guessed it, we don't halt execution of code, and
keep processing.
+
+ At this point, there's no more code left and the game is over, and the Flow
stops.
+
+ And that's it! You have now just made your very first application using the
Flow layer.
+
+ ''TODO: Write an Intermediate Guide to the Flow -- [TonyCollen]''
+