
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Creating a Flash Fill-in Form
|
421
application must identify and return the share price. While the movie is waiting, you
should display a “Loading” message. When the share price is received (i.e., once the
data finishes loading), Flash triggers the target LoadVars object’s onLoad() handler,
where we can interpret the data and display it to the user. (Data received via
LoadVars.sendAndLoad() is stored in the target LoadVars object.)
The Flash form cycle is complete, and we’re free to do whatever we like with our pre-
cious, well-traveled bytes of content. Now let’s put our knowledge to practice by cre-
ating a simple fill-in form.
Creating a Flash Fill-in Form
This example demonstrates how to send a single text field variable from Flash to a
Perl script, named echo.pl, and how to receive a response from echo.pl in Flash. The
movie we’ll build consists of an interface and two functions—initForm() and
submitForm(). The interface includes an input text field, a Submit button, and a
movie clip that displays echo.pl’s response. The initForm() function creates the server
communication objects that send our variable between Flash and echo.pl. The
submitForm() function formats the data and sends it to echo.pl. For simplicity, our
code is attached to frame 1 of the scripts layer. In practice,