Loading external data
23
This example assumes that the data file and the SWF are both located in the same folder,
either on your computer (when you test in the emulator) or on the device’s memory card
(when you test on an actual device). To test the application on the device, you must do one of
the following:
■
Transfer the text file to your device and put it in the same folder as the SWF file.
■
Post the text file to a URL on a web server (for example, www.your-server.com/data.txt).
Then modify the
loadVariables()
call in the sample application to point to that URL,
as follows:
loadVariables("http://www.your-server.com/data.txt", "data_clip");
For an example of an application that loads data over the network, see the “Flash Lite
news reader” in
Flash Samples
.
To create the data file:
1.
Using a text editor (for example, Notepad or SimpleText), create a file that contains the
following text:
item_1=Hello&item_2=Bonjour&item_3=Hola&item_4=Buon+giorno&item_5=G'day
2.
Save the file as data.txt.
To create the Flash Lite application to load the data:
1.
Create a new document from the Flash Lite 1.1 Symbian Series 60 document template.
For more information about using Flash Lite document templates, see “Using Flash Lite
document templates (Flash Professional Only)” in
Getting Started with Flash Lite
.
2.
Save the file as dataloading.fla to the same folder that contains the text file (data.txt) that
you created previously.
3.
In the Timeline, select Frame 1 of the layer named Content.
4.
Using the Text tool, create five dynamic text fields on the Stage, as the following
figure shows:
Summary of Contents for FLASH 8-LEARNING FLASH LITE 1.X ACTIONSCRIPT
Page 1: ...Learning Flash Lite 1 X ActionScript ...
Page 4: ...4 Contents ...
Page 8: ...8 About Flash Lite 1 x ActionScript ...