Graphics Reference
In-Depth Information
Going back to Chapter 4, remember that I
talked about the amount of file size that is taken
up by Flash components such as the ComboBox.
Do you also remember how I went on to suggest
building your own custom components to save
thatfilesize?Well,whilefilesizeisstillimpor-
tant in your microsites, it
snotquiteasimpera-
tive that you stay under a given amount. If
you
'
re in any kind of situation where you might
be running tight on your deadline and you still
need to build out a form, you might stick with
the Flash components. If you need them to
match the color scheme of the site, you can
still skin them. However, if you have the time to
create your own components or if they already
exist, you can make the choice of which compo-
nent to use in your forms: Flash
'
Figure 9.9 An example of a simple form in Flash.
'
s components
or yours.
Once you have the forms built, you
'
ll need to process and
store the information being given to you. To do this from within
Flash, you
ll need an outside processing page. The processing
page can be the same as one you might use for a non-Flash site.
As a matter of fact, you could even build a single processing
page for your Flash site and your non-Flash backup site. The
only thing you
'
ll need to make sure you know is the name/value
pairs for the fields in the form. As with the non-Flash backup
site, your processing page can be in any one of many choices of
programming languages such as PHP, .NET, Ruby on Rails, and
soon.Onceyoupasstheuser
'
s information to the processing
page, it will most likely be stored in a database for later use. I
'
'
ll
get into some of those uses in just a bit, but first let
stakealook
at Example 9.4 and how to pass that information to the proces-
sing page using URLRequest and URLVariables. For the example,
we
'
'
ll assume your form has a
Submit
button and text
fields labeled
First Name,
”“
Last Name,
and
Zip Code,
as in
Fig. 9.9.
EXAMPLE 9.4
Handling form information.
function submitForm (e:MouseEvent):void{
var urlRequest:URLRequest = new
URLRequest( http://www.yoursite.com/processingpage.php );
var urlVariables:URLVariables = new URLVariables();
urlRequest.method = URLRequestMethod.POST;
urlRequest.data = urlVariables;
urlVariables.userFirst = firstNameInput.text;
Search WWH ::




Custom Search