Flash Components      Flash Menu      Flash Gallery      Flash Slideshow      FLV Player      Flash Form      MP3 Player      PhotoFlow      Flash CMS      3D Wall      Flash Scroller

Flash / AS

Silverlight

WPF

ASP.net / PHP

Photoshop

Forums

Blog

About

 


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

 

 

 

 


Introduction to XML in Flash
       by senocular

Preloaders With XML
Just like anything else loaded into Flash, you can also create preloaders for XML. Generally, however, since XML is usually light on the loading side, preloaders aren't needed. A general "Now Loading" message usually suffices. But sometimes, for those real hefty files, you may want a preloader to show the status of the XML loading.

If you're worried about learning a whole new way of making preloaders for XML, don't be. Making a preloader for XML is exactly like making one for a loaded SWF or JPEG. The only difference is that instead of calling getBytesLoaded and getBytesTotal from a movie clip, you're calling it from your XML instance. So really, you can use preloaders created for movie clips with XML so long as you reference the XML object to get bytes loaded and bytes total. Here's a quick example of a preloader that can work with XML as well as movie clips:

preloadbar_mc.onEnterFrame = function(){
if (!this.target) return (0);
var loaded = target.getBytesLoaded();
var total = target.getBytesTotal();
 
var scale = 0;
if (loaded && total){
var percent = loaded/total;
scale = 100 * percent;
}
 
this._xscale = scale;
}
 
preloadbar_mc.target = my_xml;

Where preloadbar_mc is a horizonally scaling movie clip representing the preloader and my_xml is the XML instance you wish to show the preloader for. The onEnterFrame event of the preloadbar_mc runs the preloader using a generic target to get bytes loaded and bytes total. Whether this is a movie clip or an XML instance, as long as getBytesLoaded and getBytesTotal work, it doesn't matter.


 


kirupa.com's fast and reliable hosting provided by Media Temple. flash components
The Text Animation Component for Flash CS3
Check out the great, high-quality flash extensions. Buy or sell stock flash, video, audio and fonts for as little as 50 cents at FlashDen.
Check out our high quality vector-based design packs! Flash Effect Components

Flash Templates
CSS Templates
Dreamweaver Templates

flash menus, buttons and components
Digicrafts Components The best flash components ever!
Entheos Flash Website Templates Buy and sell FLAs at Ultrashock!
Upload, publish, deliver. Secure hosting for your professional or academic video, presentations & more. Screencast.com Purchase & Download Flash Components
flash components  Learn how to advertise on kirupa.com