Text Fields and URL Encoded Data
April 17, 2000
Take a moment and look at the syntax of data.txt, (this is not
academic; it will be important later to get the thing to work):
title=The Ninth Gate
&star=Johnny Depp, some chick
&rate=R
&time=1:30, 4:00, 6:15, 9:00
&url=http://www.ninthgate.com
Here's what Flash does with this syntax:
- "something=" means that "something" is a variable and that
whatever follows "=" is the value of that variable, all the way
up to the end of the document, or until the next...
- "&" means that what follows is another variable.
- Rule#1: no spaces between variable name and "=", or between "="
and the first character of the variable value, or between "&"
and the next variable name.
- Rule#2: feel free to put wide open spaces anywhere else,
(including carriage returns)
- Rule#3: since "&" is the delimiter, we have to remind
Bubba not to use that character in his data.
Why the Text Field Displays the Variable Values:
Look at the text field properties for the title text field,
(right-Click > properties, or Modify > Text Field, or
CTRL - ALT -F). Notice first that this is an editable text field.
(You make a text field editable by selecting this button while
the field is selected:
The other necessary component is the name of the text field -
it must match one of the variables we loaded in frame 1. If you
look at the Text Field Properties dialogue for each of the text
fields in frame 2, you will see that the names match the names
of the variables in data.txt exactly.
There are a few decisions you have to make when you use a text
field this way. The most important is whether to include Font
Outlines, (anti-aliasing). If you select Include all Font
Outlines, your movie will look sharper, but your file size will
be much larger.
Load Variables
Tricks & Data, Flash Yin & Yang
Information Trapped Inside a Variable's Body
|