Home arrow Flash arrow Page 5 - Working with external data in Flash
FLASH

Working with external data in Flash


Because data for a website comes in many formats, it helps to have a variety of ways to handle this data. This article covers the different methods available in ActionScript for exchanging data.

Author Info:
By: Adi Reddy Mora
Rating: 4 stars4 stars4 stars4 stars4 stars / 26
May 11, 2005
TABLE OF CONTENTS:
  1. · Working with external data in Flash
  2. · getURL(), loadVariables(),loadVariablesNum(), loadMovie(), and loadMovieNum() methods
  3. · LoadVars Class
  4. · MovieClipLoader class
  5. · XML Class
  6. · XMLSocket Class

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Working with external data in Flash - XML Class
(Page 5 of 6 )

Extensible Mark-up Language (XML) is the future standard for exchanging structured data in Web based applications. Data in Flash can be integrated with servers that use XML technology to build sophisticated and effective, rich Internet applications.

ActionScript in Flash has a built-in XML class whose properties and methods can be used to load, parse, send, build, and manipulate XML document trees.

The methods load(), send(), and sendAndLoad() of the XML Class use HTTP or HTTPS protocol to send and load information as XML.

The load() method downloads XML from a URL and places it in an ActionScript XML object.

The send() method encodes the XML object into an XML document and sends it to a specified URL using the POST method. If specified, a browser window displays returned data.

The sendAndLoad() method sends an XML object to a URL. Any returned information is placed in an ActionScript XML object.

Apart from the above methods, the ActionScript XML Class has several other methods to let you structure the XML data in Flash to send to a server, and also to manipulate and interpret downloaded XML data from the server or file system. Methods and properties such as childNodes(), hasChildNodes(), attributes, firstChild, createElement(), and so forth let you parse and create XML files at run-time.

Now let us see a simple example for loading an external XML file into flash. 

Example:

// create a new XML object

 
var sample_xml:XML = new XML();
 
// load the XML into the sample_xml object
 
sample_xml.load("sample.xml");
 
// set the ignoreWhite property to true to ignore white spaces and
new line characters in the XML document (default value is false)
 
sample_xml.ignoreWhite = true;
 
// onLoad event handler function which fires after the loading of
XML file is complete
 
sample_xml.onLoad = function(success) {
 
 // you can perform actions on the loaded XML 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 1 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials