I’m currently stuck on loading image through xml into a surface of a cube. The cube have 6 surface with different MC. I wanted to load in image to one of the MC, and duplicate the cube according to the amount of image in the XML file.
private var materials:MaterialsList=new MaterialsList(
{front:new MovieAssetMaterial("surFront",false,true),
back:new MovieAssetMaterial("surBack",false,true),
right:new MovieAssetMaterial("surRight",false,true),
left:new MovieAssetMaterial("surLeft",false,true),
top:new MovieAssetMaterial("surTop",false,true),
bottom:new MovieAssetMaterial("surBottom",false,true)});
for (var i:Number=0; i < picList.length(); i++) {
imageLoader=new Loader ;
imageLoader.load(new URLRequest(picList*.thumb));
imageLoader.x=25;
imageLoader.y=i * 100 + 25;
imageLoader.name=picList*.largeimg;
addChild(imageLoader);
//----------------------------------------------------------------------------------------
cube=new Cube(materials,60,2,80,10,10,10);
cubeArray.push(cube);//send cube into arrays
cube.name="cube" + i;// set instance name
cube.x=Math.random() * 950 - 460;
cube.y=Math.random() * 700 - 330;
cube.z=+5;
cube.rotationZ=Math.random() * 360;
scene.addChild(cube);
}
Currently the picture is loaded into the stage. How could I assign it to load a image into the surface “front”, then only duplicate the cube, with different front image each cube?