在Papervision中设置材料上的触摸事件

时间:2014-05-03 20:46:56

标签: actionscript touch papervision3d

我正在使用papervision,并希望在多维数据集的每一侧设置一个TouchEvent。我该怎么办呢?现在我在movieclip上设置事件,我将其传递给MovieMaterial类。 MouseEvent工作正常,但TouchEvent似乎无法触发。

     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;
    }

1 个答案:

答案 0 :(得分:0)

您是否在应用程序上启用了多点触控?以下行位于主应用程序类的构造函数中:

        Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;

        Multitouch.inputMode = MultitouchInputMode.GESTURE;