How can I fix touch in Flash?

I encountered strange behavior when using AS3 TouchEvent

to handle multi-touch. In some situations, the touch lags significantly, but the flash frame rate does not change. It's like strokes are buffered and events just don't get dispatched until a few seconds after being touched.

I downloaded the demo here: https://youtu.be/omkCDqljfio

I was able to reproduce this touch delay in the Flash Player version of Flash Player, but I reproduced it on both Windows 10 and Windows 7. So I have a C # application here that hosts my AS3 test suite, but this is also can be observed if swf is viewed in Internet Explorer.

Since my application already includes hosting the SWF in a WPF window, I was trying to create a solution where the touch is received in C # and then passed to AS3. This will work fine, but it seems that my WPF window is not receiving touchframes when the touch is on WindowsFormsHost

. So, there is one more problem that I have to solve.

FlashDevelop project: https://drive.google.com/file/d/0BxC2eCzurT9rd0gzSGc4TUdQLTQ/view Visual Studio solution: https://drive.google.com/file/d/0BxC2eCzurT9rUThmRHBKWHZmbzA/view

AS3 touch events:

        Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;

        stage.addEventListener(TouchEvent.TOUCH_BEGIN, stage_touchBegin);
        stage.addEventListener(TouchEvent.TOUCH_MOVE, stage_touchMove);
        stage.addEventListener(TouchEvent.TOUCH_END, stage_touchEnd);

      

Creating screen objects that contribute to latency, presumably due to the collection phases of touch events:

        for (var i:int = 0; i < 500; i++) 
        {
            Dotter.createBGDot(_bgLayer, _shapesOn ? Shape : Sprite);
        }

      

...

    static public function createBGDot(bgLayer:Sprite, dotClass:Class):void 
    {
        var dot:* = new dotClass();
        var color:Color = new Color();
        color.brightness = Math.random();
        dot.graphics.beginFill(color.color);
        dot.graphics.drawCircle(0, 0, Math.random() * 400 + 40);
        dot.x = Math.random() * bgLayer.stage.stageWidth;
        dot.y = Math.random() * bgLayer.stage.stageHeight;
        bgLayer.addChild(dot);
    }

      

I know this is kind of an unusual situation, but I appreciate any advice on how to resolve these issues.

+3


source to share


1 answer


Now that I have used Adobe Scout I think this is a rendering issue. The frame rate is still 30fps because the processing time barely reaches 30fps. Lowering the frame rate corrects the problem.



It's still weird that touch events will have such a long delay when the frame rate will barely drop.

0


source







All Articles