I found this xml dynamic preloader in the flash 8 docs that works like a
charm. You need to tweak the location of the preloader bar, and the name of
your xml file, but it's pretty sweet for larger xml loads.
var barWidth:Number = 200;
var barHeight:Number = 6;
this.createEmptyMovieClip("pBar_mc", 9999);
var bar:MovieClip = pBar_mc.createEmptyMovieClip("bar_mc", 10);
bar.beginFill(0xFF0000, 100);
bar.moveTo(0, 0);
bar.lineTo(barWidth, 0);
bar.lineTo(barWidth, barHeight);
bar.lineTo(0, barHeight);
bar.lineTo(0, 0);
bar.endFill();
bar._xscale = 0;
var stroke:MovieClip = pBar_mc.createEmptyMovieClip("stroke_mc", 20);
stroke.lineStyle(0, 0x000000);
stroke.moveTo(0, 0);
stroke.lineTo(barWidth, 0);
stroke.lineTo(barWidth, barHeight);
stroke.lineTo(0, barHeight);
stroke.lineTo(0, 0);
pBar_mc.createTextField("label_txt", 30, 0, barHeight, 100, 21);
pBar_mc.label_txt.autoSize = "left";
pBar_mc.label_txt.selectable = false;
pBar_mc.label_txt.textColor = 0xFFFFFF;
// location of preloader on the movie stage
pBar_mc._x = -160;
pBar_mc._y = 0;
var my_xml:XML = new XML();
my_xml.ignoreWhite = true;
my_xml.onLoad = function(success:Boolean) {
pBar_mc.onEnterFrame = undefined;
if (success) {
myText.text = my_xml;
pBar_mc._visible=false;
pBar_mc.label_txt._visible=false;
trace("XML loaded successfully");
} else {
trace("Unable to load XML");
}
};
my_xml.load("Publications.xml");
pBar_mc.onEnterFrame = function() {
var pctLoaded:Number = Math.floor(my_xml.getBytesLoaded() /
my_xml.getBytesTotal() * 100);
if (!isNaN(pctLoaded)) {
pBar_mc.bar_mc._xscale = pctLoaded;
pBar_mc.label_txt.text = pctLoaded + "% loaded";
if (pctLoaded >= 100) {
pBar_mc.onEnterFrame = undefined;
}
}
}
----- Original Message -----
From: "Mike Boutin" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" <flashcoders@chattyfig.figleaf.com>
Sent: Wednesday, March 01, 2006 1:05 PM
Subject: Re: [Flashcoders] multi-threading / xml progress meter solutions?
Yes I have this problem too, except the xml im loading can be rather large
and it causes flash player to freeze up for a few seconds when parsing.
----- Original Message -----
From: "Scott Pobiner" <[EMAIL PROTECTED]>
To: <flashcoders@chattyfig.figleaf.com>
Sent: Wednesday, March 01, 2006 9:02 AM
Subject: [Flashcoders] multi-threading / xml progress meter solutions?
Hello flashcoders,
I was wondering what solutions people have for activity while trying to
load and parse XML data? My application takes a solid 2-3 seconds to
load and all attempts to build preloaders and progress meters seem to
fail. It seems that the application is hanging while it sorts out the
XML data.
I suppose that this topic might also be valuable for other applications.
Thoughts? Comments?
Thanks all,
Scott
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com