I’m importing bitmaps from an xml file and need each bitmap to be named as a different movie clip.
The commented area, “This is the Line”, in the below code could easily be BlankMovieClip.addChild(imageLoader). However, then all my bitmaps would be in the same container, and I need each one to have an individual name so I can modify their properties. The amount of imported bitmaps will vary, so it all has to be very flexible.
Any advice?
Thanks!
Aaron
xmlLoader.load(new URLRequest("materials.xml"));
xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
function xmlLoaded(event:Event):void
{
colors = XML(event.target.data);
colorList = colors.children();
for(var i:int = 0; i < colorList.length(); i++)
{
imageLoader = new Loader();
imageLoader.load(new URLRequest(colorList*));
imageLoader.blendMode=colorList*.@blend;
imageLoader.name=colorList*.@name;
addChild(imageLoader); //THIS IS THE LINE
}
}