Creating a simple application
391
Creating a simple application
The following example walks you through creating a simple data integration application,
which can help you understand the concepts and steps involved.
In the example, you create a simple application that loads and displays a dinner menu. You
load an XML file, which you’ll use both as a data source and as a sample of the data source’s
schema (structure). The UI consists of a data grid, into which the XML data is loaded, and a
button that loads the data. Data binding is supported only between components that exist in
Frame 1 of the main Timeline, Frame 1 of a movie clip, or Frame 1 of a screen; in this
example, the components all reside in Frame 1 of the main Timeline.
Note that all of the namings in this example are case-sensitive.
To create the dinner menu application:
1.
Copy the data source, an XML file called dinner_menu.xml, from following location:
■
In Windows, browse to
boot drive
\Program Files\Macromedia\Flash 8\Samples and
Tutorials\Samples\DataIntegration\DinnerMenu\
■
On the Macintosh, browse to
Macintosh HD
/Applications/Macromedia Flash 8/
Samples and Tutorials/Samples/DataIntegration/DinnerMenu/.
2.
In Flash, create a new Flash document and save it as
dinner_menu.fla
in the Dinner Menu
folder you created in step 1.
3.
Create the user interface, which consists of two components—a button that triggers data
retrieval and a data grid to display the data:
a.
From the Components panel, add a DataGrid instance named
menu_dg
to the Stage
with width
540
and height
240
.
b.
Also from the Components panel, add a Button component instance named
loadData
below the data grid labeled
Load Data
.
4.
Add the data components—an XMLConnector component to connect to the
dinner_menu.xml file and a DataSet component to bind that data to the data grid:
a.
Add an XMLConnector component instance named
xmlConn
.
b.
Add a DataSet component instance and name it
menu_ds
.
The data components do not have to be on the Stage; they don’t appear at runtime.
5.
Set parameters for the XMLConnector component: select the XMLConnector component
instance and, in the Component inspector, click the Parameters tab, enter
dinner_menu.xml
for the URL, and select
receive
for the direction. (Because the
XML file is in the same folder as the FLA file, the fully qualified path is simply the
XML filename.)
Содержание FLASH 8-FLASH
Страница 1: ...Using Flash ...
Страница 12: ...12 Contents ...
Страница 110: ...110 Using Symbols Instances and Library Assets ...
Страница 128: ...128 Working with Color Strokes and Fills ...
Страница 156: ...156 Drawing ...
Страница 190: ...190 Working with Text ...
Страница 224: ...224 Working with Graphic Objects ...
Страница 270: ...270 Creating Motion ...
Страница 310: ...310 Working with Video ...
Страница 362: ...362 Working with Screens Flash Professional Only ...
Страница 386: ...386 Creating Multilanguage Text ...
Страница 454: ...454 Data Integration Flash Professional Only ...
Страница 500: ...500 Publishing ...
Страница 534: ...534 Creating Accessible Content ...