Something really simple:
I want to setup multiple instances of the same object, so I thought it
would be easier to create a custom class and then just call new
instances of that, but it just is not returning what it should
can anyone highlight what is going wrong:
-- the specific cube class
package com.myCUBE
{
import away3d.core.base.Object3D;
import away3d.materials.ColorMaterial;
import away3d.primitives.Cube;
public class innerCube
{
public var aCube:Cube;
public function innerCube(cubeMat:Array, cubeSize:uint,
cubeName:String)
{
buildCube(cubeMat, cubeSize, cubeName);
//trace(cubeMat, cubeSize,cubeName);
}
private function buildCube(cubeMat:Array, cubeSize:uint,
cubeName:String):Object3D {
aCube = new Cube();
aCube.material = new ColorMaterial(0xffcc00);
// aCube.cubeMaterials.front = new ColorMaterial(0xCCCCCC);
// aCube.cubeMaterials.back = cubeMat[1];
// aCube.cubeMaterials.left = cubeMat[2];
// aCube.cubeMaterials.right = cubeMat[3];
// aCube.cubeMaterials.top = cubeMat[4];
// aCube.cubeMaterials.bottom = cubeMat[5];
aCube.bothsides = true;
aCube.width = aCube.height = aCube.depth = cubeSize;
aCube.name = cubeName;
return aCube;
}
}
}
--
then in the application (separate class):
import com.myCUBE.innerCube;
protected function initObjects():void {
var rowA_0:Cube = new innerCube(mat1, 500, "A0");
rowA_0.rotationX = 45;
rowA_0.rotationY = 45;
view.scene.addChild(rowA_0);
trace("Objects initialised");
}
--
what is happening is that it is adding a cube on the stage but taking
none of the properties set by the innerCube class..
tia