Tài liệu Understanding Data Sources and Data Formats - Pdf 87


< Day Day Up >

Understanding Data Sources and Data Formats
A data source is a place from which Flash can load external data (that is, data not directly
programmed into the movie). For example, Flash can load data from a simple text file,
and that text file is considered a data source. Data transfer is the act of retrieving data
from a source or sending data from Flash to another application. In this section, you'll
learn about the different types of data sources as well as the Flash objects and methods
used to communicate with these sources in the data transfer process.
Any data that you plan to load into Flash from an external source must be structured
(formatted) in a specific way. Flash supports the following formats:

URL string. In this type of name/value pair formatting, variables and their values
are defined as a string of text. For example, the following text string:



name=Jobe&website= &hairColor=brown
• defines three variables (name, website, hairColor) and their respective values
(Jobe, , brown). After this text string has been loaded,
Flash automatically breaks it into its respective variable names/values, making
them available for use just as any other variables. An equals sign (=) is used to
associate a variable name with its value and an ampersand (&) marks the end of
one variable and the beginning of another. You will use this format in an exercise
later in this lesson. The format supports an unlimited number of variables. Only
simple variables can be stored in URL string format; data contained in objects,
arrays, or any other data type is not supported by a string of text.

<Name>Virginia</Name>



<Capital>Richmond</Capital>



</State>



</States>
• After an XML document is loaded into Flash, a script that you write is used to extract
information from the XML document.
NOTE
See Lesson 12
, "Using XML with Flash," for more information on the XML format.


Shared objects. These will be discussed later in this lesson; for now, understand
that shared objects are similar to Flash cookies: shared objects allow you to store
objects (data) locally on the user's hard drive. This means that after a user views
and exits a Flash movie (as a projector or online), the data created while the movie
was playing (user's name, last section visited, and so on) is saved. This data can be
retrieved the next time the user plays the movie on the same computer. By using
shared objects, you can store not only variables and their values, but any kind of

via the socket using the XML format. (You'll learn more about socket servers—
including how to build a chat application with them—in Lesson 12
, "Using XML
with Flash.")

Shared objects. As already mentioned, shared objects are used to create data files
that store information on a user's hard drive. You can then retrieve these files for
use with a movie, as you will see in the last exercise in this lesson.

< Day Day Up >


Nhờ tải bản gốc

Tài liệu, ebook tham khảo khác

Music ♫

Copyright: Tài liệu đại học © DMCA.com Protection Status