I have some problem. I'm loading some *.xml, get from there some
attribute in wich I have URL to my pictures. It works correct. After
it I want to load pictures and write them into array. I think the
problem is that cycle works faster then images loading. I need to run
the cycle and complete the step only when image is loaded and have
wrote into array. Sorry for my bad english. Need help.
public var elementCounter:int=0;
...
public function showXML(e:Event):void
{
xmlData=new XML(e.target.data);
xmlList=xmlData.children();
xmlListLength=xmlList.length();
for (var i:int=0; i < xmlList.length(); i++,
elementCounter++)
{
var picLoader:Loader=new Loader();
picLoader.load(new
URLRequest(xmlList[i].attributes()[0]));
picLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
ImageLoaded);
}
}
private function ImageLoaded(e:Event):void
{
var planeMaterial:BitmapMaterial = new
BitmapMaterial(Cast.bitmap(e.target.content));
materialArray[elementCounter]=planeMaterial;
}