hey john
thanks for the reply.
Still not working for me though i have followed the above. It doesnt work in simulator (though MouseEvents3D work just fine), doesnt work in IOS. But on android i see that it is working but incorrectly.
I basically have a rubiks cube with 27 cubes and 6 plane faces each which have a touch event on them. On android the touch seems to register outside each cube face usually around top leftish. As a result it detect touch on a cube other than the one i touched.
I am attaching the files if its possible to check, else the relevant code is below. Else if someone can give working examples would be great.
public class MultiMaterialCube extends ObjectContainer3D
{
private var iconArr = new Array('Atom','FireBall','FlashIcon','Music','SmileyIcon');
protected var faceFront:Mesh;
protected var faceBack:Mesh;
protected var faceTop:Mesh;
protected var faceBottom:Mesh;
protected var faceLeft:Mesh;
protected var faceRight:Mesh;
private var faceNames:Array = ['faceFront','faceBack','faceTop','faceBottom','faceLeft','faceRight'];
protected var cubeContainer:ObjectContainer3D = new ObjectContainer3D ;
protected var mergedMesh:Mesh;
import flash.ui.Multitouch;
import flash.ui.MultitouchInputMode;
public function MultiMaterialCube(width:Number=100,height:Number=100,depth:Number=100,frontMat:MaterialBase=null,backMat:MaterialBase=null,topMat:MaterialBase=null,botMat:MaterialBase=null,leftMat:MaterialBase=null,rightMat:MaterialBase=null,mergeMeshes:Boolean=false):void
{
Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
mouseEnabled = true;
mouseChildren = true;
var textureArr = new Array ;
for (var f = 0; f < 6; f++)
{
var ClassReference:Class = getDefinitionByName(iconArr[Math.floor(Math.random() * iconArr.length)]) as Class;
var bd1:BitmapData = new BitmapData(64,64,false,0xFFFFFFFF);
bd1.draw(new ClassReference );
var tm:TextureMaterial = new TextureMaterial(Cast.bitmapTexture(bd1));
textureArr.push(tm);
}
var defaultMaterial:ColorMaterial = new ColorMaterial(0x666666,.5);
var geom:PlaneGeometry = new PlaneGeometry(64,64,64,1);
// --------------xx
faceFr Mesh(geom,textureArr[0] || defaultMaterial);
faceFront.z = -32;
faceBack = new Mesh(geom,textureArr[1] || defaultMaterial);
faceBack.z = 32;
faceTop = new Mesh(geom,textureArr[2] || defaultMaterial);
faceTop.y = 32;
faceBottom = new Mesh(geom,textureArr[3] || defaultMaterial);
faceBottom.y = -32;
faceLeft = new Mesh(geom,textureArr[4] || defaultMaterial);
faceLeft.x = -32;
faceRight = new Mesh(geom,textureArr[5] || defaultMaterial);
faceRight.x = 32;
var faceStr:String;
faceBack.mouseEnabled = faceFront.mouseEnabled = faceTop.mouseEnabled = faceBottom.mouseEnabled = faceLeft.mouseEnabled = faceRight.mouseEnabled = true;
this.mouseEnabled = this.mouseChildren = true;
for each (faceStr in faceNames)
{
this.addChild(this[faceStr]);
this[faceStr].mouseEnabled = true;
this[faceStr].pickingCollider = PickingColliderType.AS3_FIRST_ENCOUNTERED;
//PickingColliderType.AS3_FIRST_ENCOUNTERED;;
//PickingColliderType.PB_BEST_HIT;
//this[faceStr].addEventListener(MouseEvent3D.MOUSE_DOWN, meshMouseDown);
//this[faceStr].addEventListener(MouseEvent3D.MOUSE_UP, meshMouseDown);
this[faceStr].addEventListener(TouchEvent3D.TOUCH_BEGIN,meshMouseDown);
}
}
//this[faceStr].addEventListener(TouchEvent3D.TOUCH_END, meshMouseDown);
};
};
public function meshMouseDown(e:Event)
{
trace("meshMouseDown");
var ClassReference:Class = getDefinitionByName(iconArr[Math.floor(Math.random() * iconArr.length)]) as Class;
var bd1:BitmapData = new BitmapData(64,64,false,0xFFFFFFFF);
bd1.draw(new ClassReference );
var tm:TextureMaterial = new TextureMaterial(Cast.bitmapTexture(bd1));
e.target.material = tm;
}
regards
sid