Oky, so I’m trying to create a number of materials and at a certain stage I have
loadImage(material_1, face1, cubeFaceArray[0].attribute);
where previously I’ve specified var:material_1:MaterialBase;
so that calls this function:
private function loadImage(targetMat, targetFace, imagePath):void
{
trace ("loading image into " + targetMat + " from " + imagePath)
if (material_1 == targetMat)
{
trace ("targetMat is material_1");
}
//If I uncomment this, material_1 does not end up as expected
//targetMat = new ColorMaterial(0x444444);
//If I uncomment this, material_1 does end up as expected
//material_1 = new ColorMaterial(0x444444
//TODO this will need to be moved to the LoadSuccess function
materialsPrepared += 1;
if (materialsPrepared == 6)
{
createMultiCube();
}
}
but changing ‘targetMat’ from within there, does not seem to change material_1, even thought they are supposed to be the same (you can see I even put a check in there to make sure, and that traces as expected)
However, if I changed material_1 directly in there, then when the face that uses material_1 is made, it does indeed have the correctly coloured face..
Like I say, I am really puzzled by this one..