Hey,
I have a flash website, which has 4 menu options, each of which when you click fetches a different XML file in which the child nodes indicate the content, or description of an item, and fetch a external image to represent it on stage. Each menu option when clicked gets a new XML file, replacing the old one in the xml variable. Once the XML is loaded (xml.onLoad()) it sends it to a function (loadItems) to place each item on stage. Obviously, when uploaded onto the Internet, when a XML loads, the images are still loading, thus the Tween effect of them appearing on stage can’t be seen.
I need to find a way of how to create a preloader, that would show the status of ALL the images download progress, and once complete, starts the Tween effect of them appearing on stage.
loadItems function (places the external images from the XML file on stage):
var xml:XML = new XML();
xml.ignoreWhite = true;
function loadItems()
{
var nodes = this.firstChild.childNodes;
numOfItems = nodes.length;
for(var i=0;i<numOfItems;i++)
{
var t = home.attachMovie("item","item"+i,i);
t.icon.inner.loadMovie(nodes*.attributes.image);
t._x = i*50;
t._y = 395;
t._alpha = 0;
t._xscale = t._yscale = 0;
}
for (i=0; i<numOfItems; i++)
{
var tw:Tween = new Tween(home["item"+i], "_alpha", Strong.easeOut, home["item"+i]._alpha, 80, 1, true);
var tw:Tween = new Tween(home["item"+i], "_xscale", Strong.easeOut, home["item"+i]._xscale, 50, 1, true);
var tw:Tween = new Tween(home["item"+i], "_yscale", Strong.easeOut, home["item"+i]._yscale, 50, 1, true);
}
}
Each menu button, when released:
xml.load("xmlfile.xml");
xml.onLoad = loadItems;
**Sample a node in the XML file:
**
<icons>
<icon image="1.png" content="Description of item." />
</icons>
Any ideas or suggestions?
Thanks in advance!
M12