April 21, 2009

Loading XML Data from External Sources

The subject of loading data from servers is much more involved than can be covered in a chapter on XML. Therefore, we discuss this in its own section later on in the book. However, in case you’re really itching to try loading some data from a server, these are the basics of how it’s done.

In the AS2 implementation of XML, the data was loaded through a method called by the XML class. However, in AS3, that functionality has been moved outside of the class to the flash.net package. In this example we use a URLLoader to load the XML file and then create an XML object from the data we’ve loaded

import flash.net.*;
var myXML:XML;
var url:URLRequest = new URLRequest(“http://www.your-domain.com/test.xml”);
var loader:URLLoader = new URLLoader(url);
loader.addEventListener(Event.COMPLETE, onLoadComplete);
function onLoadComplete(event:Event):void {
if (loader.data) {
myXML = XML(loader.data);
}
}

0 comments:

Post a Comment

 

About

we are doing all kind of web / standalone applications using Flash , FMS, PHP , XML , CSS , etc. we handle all projects starting from the initial design concept through the delivery of your personalized product. Our commitment to you is comprehensive and complete-aimed at satisfying your every need. We have the experience and the expertise to get the job done.

Site Info

we Currently handling web requirements and multimedia productions and we have the capability of cutting your web , graphics and multimedia expenses to a bare minimum without sacrificing professional quality or delaying production. Our focus is on the development of smart, successful ideas and we always strive to maintain the highest . we currently using following technologies Flash 8, Flash cs3,Actionscript 2 ,Action script 3 ,Flash Media server , PHP,AMFPHP,XML ,HTML ,CSS ,Photoshop

Text

Digizone, AnnaNagar East, Chennai, TamilNadu ,India. Please view our website for further details

Flash and photoshop resources FREE Download Copyright © 2009 Community is Designed by Bie