Reputation: 1
I am working with papervision and would like to setup a TouchEvent on each side of a Cube. How would i go about it ? Right now i am setting up the events on the movieclip which i pass to the MovieMaterial class. The MouseEvent is working fine but the TouchEvent doesn't seem to fire.
public function MiniCube(k:int, j:int, i:int)
{
var matList:Object = {all:new ColorMaterial(0xff0000,1,true)};
matList.back = createColorMC(0x000000,'back');
matList.front = createColorMC(0x000000,'front');
matList.top = createColorMC(0x000000,'top');
matList.bottom = createColorMC(0x000000,'bottom');
matList.right = createColorMC(0x000000,'right');
matList.left = createColorMC(0x000000,'left');
cube = new Cube(new MaterialsList(matList),10,10,10);
}
private function createColorMC(color:uint, name:String):MovieMaterial
{
var ClassReference:Class = getDefinitionByName(iconArr[Math.floor(Math.random() * iconArr.length)]) as Class;
var mc=new ClassReference();
mc.name = name;
//MOUSE EVENT WORKS
mc.addEventListener(MouseEvent.MOUSE_DOWN, onMovieMatClicked);
//TOUCH EVENT DOESNT
mc.addEventListener(TouchEvent.TOUCH_BEGIN, onMovieMatClicked);
var movieMat:MovieMaterial = new MovieMaterial(mc,true,true);
movieMat.interactive = true;
movieMat.smooth = true;
movieMat.animated = true;
return movieMat;
}
Upvotes: 0
Views: 27
Reputation: 141
Did you enable multitouch on your application? The following line goes in the constructor of your main application class:
Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
or
Multitouch.inputMode = MultitouchInputMode.GESTURE;
Upvotes: 0