[ vilenjak_ @ 05.09.2007. 18:07 ] @
Moze li neko da mi pomogne oko XML preloader-a? Kako da napravim isti? Ukoliko neko mozda ima link ka nekom video tutrial-u bio bih mu mnogo zahvalan.
UNAPRED ZAHVALAN..POZDRAV SVIMA
[ Vranac @ 06.09.2007. 07:14 ] @
Flash 8, AS 2.0

Code:

// import the delegate class
import mx.utils.Delegate;

// declare the var for the XML
var xmlContent:XML;
xmlContent = new XML();

// ignore all the excess white space
xmlContent.ignoreWhite = true;

// load the xml file itself
// use sendAndLoad if you want to pull it from a post request
xmlContent.load("./xml/playlist.xml");

// set the event handler that will catch the load complete event
xmlContent.onLoad = Delegate.create(this, xmlLoaded);

// function that will fire when the loading is complete
function xmlLoaded(success:Boolean) {
    if (success) {
        // if loading was a success call a new function that
        // will process the xml
        processXML();
    } else {
        // crapped out
        trace("crapped out");
    }
}

// process the xml file that is loaded
function processXML() {
    trace("processXML called");
    trace("xmlContent: " + newline + xmlContent);
}