Flash / AS

Silverlight

WPF

ASP.net / PHP

Photoshop

Forums

Blog

About

 


FlashComponents
  Galleries
  Slideshows
  Menus
  Design & Effects
  Audio & Video
  User Interface
  Templates

  

 

 

 

 

 
Displaying
XML Data in Flash - Page 5
        by kirupa  |  24 July 2004

In the previous page you learned how to navigate through the XML file in order to pick the right data to display in Flash. This page will summarize the previous 4 pages and send you off on your merry way to spread the goodness of XML in more creative, better XML/Flash masterpieces.

Quick Summary
The following section will summarize the code and the XML using broad generalizations and oversimplified explanations to help you to see the larger picture of what we accomplished:


In Flash you first assign a variable to the XML object. This now gives you easy access to all of the XML features of Flash. You then make sure that your XML file is loaded before giving Flash any more instructions on using the XML file. You define a new event handler - usually onLoad - to run a function that checks to see if Flash loads the XML file you specify.

If the XML file is loaded, Flash will continue to execute any events you place that require use of the XML file. The XML file you loaded is a relatively simple XML file with a root node, two child nodes, and two more child nodes contained within those child nodes.

Using Flash, you traverse down the nodes starting with the root node and moving down. You use index-like values (0 or 1 for our example) to decide which node you want Flash to be going through. You use the nodeValue property (optional for recent versions of Flash) to acquire the attribute from the XML file after having reached the end of your XML node traveling adventures.

You assign the data from the XML file to a variable, and those variables are then assigned to two text fields that display the data to you and your viewers in the Flash file.

Phew! You can download the ZIP file that contains the SWF, FLA, and XML file in case you are curious as to how my version turned out. It should be the same really


Download ZIP

[http://www.kirupa.com/pages/me.htm]

 


page 5 of 5


 




SUPPORTERS:

kirupa.com's fast and reliable hosting provided by Media Temple.