I have the following code.
If I place the add the Cube after instantiating the cubeMaterials it
works fine, but if before, it doesn't work.
So what if want to change the Material to another image later on
runtime ?
var loader:Loader = new Loader();
loader.load(new URLRequest("Portfolio/ADVERTISMENT/tn_ADV 01.jpg"));
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,photoLoaded);
var mc:MovieClip = new MovieClip();
mc.addChild(loader);
stage.addChild(mc);
function photoLoaded(evt:Event)
{
var cube:Cube = new Cube();
view.scene.addChild(cube);
var movieMat:MovieMaterial = new MovieMaterial(mc);
var mat:CubeMaterialsData = new CubeMaterialsData();
mat.front = movieMat;
mat.top = movieMat;
mat.bottom = movieMat;
mat.left = movieMat;
mat.right = movieMat;
mat.back = movieMat;
cube.cubeMaterials = mat;
}