Preloading images from XML into Flash

Posted by tykebikemike on Stack Overflow See other posts from Stack Overflow or by tykebikemike
Published on 2010-06-18T04:10:30Z Indexed on 2010/06/18 4:13 UTC
Read the original article Hit count: 246

Filed under:
|

I know this has been asked to death, but I cant seem to find the answer i'm looking for... I've put together a simple Flash/XML image gallery and I would like to preload the images - Simple process.

  1. Get the XML data
  2. Preload the images
  3. When all images are preloaded, go to next frame

Here is my code thus far:

var myXML:XML = new XML();
myXML.ignoreWhite = true;
myXML.load("xmltest.xml");

myXML.onLoad = function(success){
 if(success){
  var myImage = myXML.firstChild.childNodes;

  for (i=0; i<myImage.length; i++){
   var imageNumber = i+1;
   var imageName = myImage[i].attributes.name;
   var imageURL = myImage[i].firstChild.nodeValue;

   trace('image #: ' + imageNumber);
   trace('image name: ' + imageName);
   trace('image url: ' + imageURL + '\n');
  }
 }
}

© Stack Overflow or respective owner

Related posts about Xml

Related posts about actionscript-2