Hi all,
I am loading in a series of assets from an xml file like this:
<?xml version="1.0" encoding="utf-8"?>
<site>
<asset name="background" src="assets/backgrounds/red_wood.jpg" type="image" container="background_holder" width="100" height="100" />
</site>
I then loop through each asset node and add it to a LoaderMax var. The problem I am having is that I want to declare the container for the asset I am loading in the XML file, but when I try the following code I get this error message:
Error #1034: Type Coercion failed: cannot convert XMLList@2ebc2e51 to flash.display.MovieClip.
Can anyone help me with this please?
Thanks!
var xml:XML = event.target.content;
var assetsList:XMLList = xml.asset;
var mainLoader:LoaderMax = new LoaderMax({name:"mainLoader",onComplete:mainLoaded,onProgress:mainProgressHandler});
for (var i:int = 0; i < assetsList.length(); i++) {
var assetLoad:ImageLoader = new ImageLoader(assetsList*.@src, new ImageLoaderVars()
.name(assetsList*.@name)
.width(assetsList*.@width)
.height(assetsList*.@height)
.smoothing(true)
.container(MovieClip(assetsList*.@container))
);
mainLoader.append(assetLoad);
}
mainLoader.load();