Home arrow Flash arrow Page 2 - A Simple XML-Based Searchable Database
FLASH

A Simple XML-Based Searchable Database


This tutorial is about creating a simple database with XML and integrating it into Flash. Since there are a number of ways to parse XML such as XSL or JavaScript, why would you want to use Flash? Because it is platform independent and has powerful features for combining text and pictures.

Author Info:
By: Joachim Schnier
Rating: 4 stars4 stars4 stars4 stars4 stars / 35
July 21, 2004
TABLE OF CONTENTS:
  1. · A Simple XML-Based Searchable Database
  2. · The XML File and Tree
  3. · The Fla File
  4. · ActionScript for Search Engine Continuation
  5. · The Button Scripts

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
A Simple XML-Based Searchable Database - The XML File and Tree
(Page 2 of 5 )

The XML File

One of the XML files used in this tutorial is shown here, starting with the XML declaration and followed by the XML tree. The XML syntax is very strict and unlike HTML is case sensitive. An opening tag (for example <models>) must be followed by a closing tag ( </models> ).

<?xml version="1.0"?>                       
<models>                                        
  <monica name="Monica" photo="pic_1.swf"> 
    age: 21                                                       
    eye color: dark blue
    hair color: blond
    height: 179 cm
    weight: 185 pounds
  </monica>
  <heather name="Heather" photo="pic_2.swf"> 
    age: 30
    eye color: black
    hair color: dark brown
    height: 170 cm
    weight: 145 pounds
  </heather>
  <kim name="Kim" photo="pic_3.swf"> 
    age: 25
    eye color: green
    hair color: black
    height: 163 cm
    weight: 125 pounds
  </kim>
<models>
 

You should always test if your file has the correct syntax by opening it in your browser window. A correct file will show up like this. (Note: On some servers, especially free servers, XML files may be altered.)

A Simple XML Based Searchable Database

An incorrect file will be detected by the browser and give you a false statement. I put a file in the file collection, which has one mistake (fmodels_false.xml).

The XML Tree

An XML file has the structure of a tree as shown in the figure below. 

A Simple XML Based Searchable Database

In order to get access to individual parts of the tree using ActionScript, we have to start at the root of the tree, which in this case is the root node <models>. ActionScript is based on Microsoft´s Document Object Model (DOM). Check other tutorials in the Web for that. The principal to get access to the XML tree is basically very similar to the way to get access to the inside of a movieclip. There is a root or parent and there are children. But now let´s focus on the actual Flash file. We will mainly focus on the functions related to the XML files. There is also a preloader for pics, which however will not be discussed further in detail here.


blog comments powered by Disqus
FLASH ARTICLES

- More Top Flash Game Tutorials
- Top Flash Game Tutorials
- Best Flash Photo Gallery Tutorials
- The Top Flash Tutorials for Menus
- 7 Great Flash Tutorials
- Adobe Creative Suite 5.5 Now Available
- Critical Flash Vulnerability Heats Up the Web
- More on Nonpersistent Client-Side Remote Sha...
- Nonpersistent Client-Side Remote Shared Obje...
- Using the Decorator Pattern for a Real Web S...
- Using Concrete Decorator Classes
- Delving More Deeply into the Decorator Patte...
- The Decorator Pattern in Action
- A Simple Decorator Pattern Example
- Decorator Pattern

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 3 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials