Hi Fabrice,

The id attribute is read only and whether you use CubeMaterialsData or
myCube.cubeMaterials.front accessing this in MouseEvent3D only returns
[object WireColorMaterial] [object BitmapMaterial] etc depending on the
sides material (if 1 or more the same type who knows what side your clicking
on).

Example:

cube = new Cube();
cube.cubeMaterials.left = mat3;

// 3 of 6
var mat3:BitmapMaterial = new BitmapMaterial( Cast.bitmap(new hal()) );
*mat3.id = "hal 2000"; // error "Property is read-only"*


private function click(e:MouseEvent3D):void
{
// cube = e.target
// material = e.material
 trace("e.target = " + e.target);
trace("e.material = " + e.material);
trace("e.material.id = " + e.material.id); // Always traces zero
}




I have also found I cannot change the materials after cube creation:


I was trying to use:

[code]
var leftMaterialUnclicked:BitmapMaterial = new BitmapMaterial(
Cast.bitmap(new imgLeftUp()) );
cube.cubeMaterial.left = leftMaterialUnclicked;
[/code]

and then onclick (addonmousedown) event - change the material using:

[code]
var leftMaterialClicked:BitmapMaterial = new BitmapMaterial( Cast.bitmap(new
imgLeftDown()) );
cube.cubeMaterial.left = leftMaterialClicked;
[/code]


I have also tried this using "CubeMaterialData", so when a click is
registered the following happens:

[code]
var cubedata:CubeMaterialsData = new CubeMaterialsData(
{top:mat1, bottom:mat2, front:mat3, back:mat1, left:mat1, right:mat1})

cube.cubeMaterials = cubedata; // no change
[/code]


and tried
[code]
cube.cubeMaterials.front = mat3; // no change
cube.cubeMaterials.back = mat3; // no change
cube.cubeMaterials.left = mat3; // no change
cube.cubeMaterials.right = mat3; // no change
cube.cubeMaterials.top = mat3; // no change
cube.cubeMaterials.bottom = mat3; // no change
[/code]



Fun with cubes eh lol



Darcey

Reply via email to