XML, External Files and HTML - Page 4
April 2, 2001
A few of the very interesting features that have been implemented
into Flash are the new
XML
features. This gives the developer the ability to easily use
external text files to update information inside the Flash file
and even use limited HTML tags to dynamically change the
information.
XML stands for Extensible Markup Language and has become a
standard for interchanging structured data in Internet
applications. Flash can now integrate XML data with servers that
use the technology to build highly sophisticated applications.
Developers can use the methods of the ActionScript XML object to
structure XML data in Flash to send commands to the server to
manipulate and interpret downloaded XML data. Examples include
appendChild, removeNode, and
insertBefore. Here are some XML object methods to
load and send XML data to a server with the HTTP method using
Post:
Send passes an XML object to a URL. Any returned
data will be sent to another browser window.
Load downloads an XML object from a URL and
places it in an ActionScript XML object.
SendAndLoad sends an XML object to a URL. Any
returned information is then in turn placed in an ActionScript
XML object.
Using external text files is an excellent feature of Flash that
allows even non-Flash gurus to quickly and easily update
information inside a file without ever needing to reopen the
original Flash source file (.FLA).
This is done by creating a text box using the Dynamic Text
option located under the Text Options menu selection. The
box is then defined with a variable name. The text format and
size can also be determined at the same time. Using this
method, the developer is able to take the variable name assigned
to it and create a simple text file by using the statement
'variablename=hello world' (without quotes). The
'LoadVariables' command loads the assigned value of
the variable from the text file displayed inside the text box. If
there is quite a bit of text, scroll buttons or a scroll bar can
be created that would allow the reader to simply scroll up and
down through the text to view the entire element.
At this stage HTML codes can be used. Although the number of
available codes is limited, this method can certainly create some
very easily updatable Flash files and allow them to look totally
original every time. In order for this to work correctly the user
must select the HTML option when creating a dynamic text
box inside of the Flash file. This allows the text to contain
HTML tags directly inside the file and is used to format the text
once it is brought in.
The HTML codes available to create text files are:
<b>Shawn Ryder</b> -
The bold tag is simply used to create bolder text inside of the
dynamic text box.
<font color="#FFFFFF"> - Allows you to update
the color of the font you are using inside the text box. This is
a good way to highlight a new update of the text by changing the
color from what it was previously. To change the text back to the
original color insert </font> at the end of
the text.
<font size="+1"> - This allows you to change
the size of the font inside of the text box. It can be done
either using relative sizes (<font size="+2">)
or with absolute sizes (<font size="6">). To
end the formatting simply add </font> to the
end.
<I> Shawn Ryder
</I> - The italics tag simply places the text
in italics inside of the text box.
<p> - The paragraph tag creates paragraphs
inside of the text box to maintain formatting. It also can be
aligned using either align="right",
align="left", or align="center". Use
</p> to end the paragraph.
<u> - The underline tag is extremely
straightforward. Using this will format the text inside the
dynamic text box with an underline. Just as with all of the other
formatting options, once complete turn it off by using
</u>.
<a> -The anchor tag creates links inside of
the Flash text box just as it would on any Web page using HTML.
This will allow the developer to use the 'href' tag
inside of the anchor itself to create an interactive link to
another page or Web site. This feature can be used to maintain
updates such as 'special of the day' or 'updated news'. It also
can be easily changed by uploading a new text file to the server.
It then updates the Flash file instantly. To end the link, add
</a> to the end.
The tags are used just as they would be in any common HTML
document. All you need to do is put them inside of the text file
that your variable will be calling on and make sure that the text
box 'HTML' option is selected.
This concludes our overview of Macromedia Flash 5. Hopefully it
will help you to make any decisions on whether your Web site
could use the application to create some interesting features.
The ActionScript language continues to grow at a fantastic rate
and will surely become even more powerful as future versions of
this great product are available.
Updates and Changes - Page 3
Flash 5
|