Highlighted

Multitouch primaryTouchPoint releases all touch points

New Here ,
Sep 04, 2017

Copy link to clipboard

Copied

We are currently developing an AIR app for desktop using Flex and AS3 in Flash Builder and we're running into an issue with multitouch annotations. The easiest way to replicate would be to draw a line using index finger. Whilst continuing to draw with index finger, press down middle finger and create a second line. Whilst both fingers are down release the index finger, both strokes stop drawing even though middle finger is still down and moving.

When I check which uniqueID's have been released in TouchEnd, removing the primary touch point will end all other uniqueID's also, effectively stopping multitouch until all touches are released and a new primary touch point is detected. This happens with any amount of touch points greater than 1.

On some systems we have noted that the strokes do continue, but performance is decreased dramatically (fps = 1). We have also noted that this is only an issue on Windows 8 and 10. To make this all even stranger, I have made a new app with just a multitouch canvas, tried examples of multitouch drawing apps from Adobe DevNet and others. All seem to have this issue.

The only time I've had any success is an ActionScript project that launched in Internet Explorer. When I used the same code in a new ActionScript project within FlashBuilder using AIR, we ran into the same issues as above. We are using AIR 26.0 and SDK's are up to date. Has anybody else ran into this issue?

The following is an example we found from "Char95 » Blog " which worked in internet explorer, but not in AIR:

package

{

import flash.display.*;

import flash.events.*;

import flash.text.*;

import flash.filters.BlurFilter;

import flash.geom.*

import flash.utils.*;

import flash.ui.*;

import com.char95.utils.*;

import flash.desktop.NativeApplication;

public class MultiTouchScreen extends Sprite

{

private const _touches:Object = new Object();

private const _touchesDistance:Array = new Array();

private const SQRT:Function = Math.sqrt;

protected const BMP_SCALE:Number = 1/2;

protected const DIM_AMT:Number = 1.015;

protected const DIM:ColorTransform = new ColorTransform(DIM_AMT, DIM_AMT, DIM_AMT);

protected var sourceBmp:BitmapData;

protected var colorBmp:BitmapData;

protected var fingerShape:Shape = new Shape();

protected var isMultitouch:Boolean = false;

protected var isMouseDown:Boolean = false;

private var _colors:Array = new Array(0xff0000,0x00ff00,0x0000ff,0xffff00,0xff00ff,0x00ffff);

private var _bitmapData:BitmapData;

private var _nTouches:uint = 0;

private var _font:Font = new AppFont();

private var _format:TextFormat = new TextFormat(_font.fontName, 30, 0x68a4e1); // text format

private var _formatId:TextFormat = new TextFormat(_font.fontName, 50, 0xffffff); // text format

private var _tf:TextField = new TextField();

public function MultiTouchScreen(wo:uint,ho:uint)

{

//_bitmapData = new BitmapData( 480 , 800 , true , 0x0 );

_bitmapData = new BitmapData( wo , ho , true , 0x0 );

try {

if (Multitouch.supportsTouchEvents)

{

Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;

isMultitouch = true;

}

Log.add('Multitouch device:'+Multitouch.supportsTouchEvents)

}

catch (error:ReferenceError)

{

Log.add("Sorry, but multitouch is not supported in this runtime.");

}

addEventListener ( Event.ADDED_TO_STAGE , addedToStage );

_tf.defaultTextFormat = _format;

_tf.autoSize = TextFieldAutoSize.LEFT;

_tf.multiline = false;

_tf.border = false;

_tf.borderColor = 0xff0000;

_tf.wordWrap = true;

_tf.selectable = false;

_tf.embedFonts = true;

_tf.antiAliasType = AntiAliasType.ADVANCED;

addChild(new Bitmap(_bitmapData));

}

protected function addedToStage( e:Event ):void

{

if (isMultitouch)

{

stage.addEventListener( TouchEvent.TOUCH_BEGIN , touchAdd );

stage.addEventListener( TouchEvent.TOUCH_MOVE , touchMove );

stage.addEventListener( TouchEvent.TOUCH_END , touchRemove );

stage.addEventListener( TouchEvent.TOUCH_OUT , touchOut );

stage.addEventListener( TouchEvent.TOUCH_ROLL_OUT , touchRollOut );

stage.addEventListener( TouchEvent.TOUCH_TAP , touchTap );

}

else

{

stage.addEventListener( MouseEvent.MOUSE_DOWN , function():void{isMouseDown = true} );

stage.addEventListener( MouseEvent.MOUSE_UP , function():void{isMouseDown = false} );

stage.addEventListener(Event.ENTER_FRAME, onEnter );

}

}

private function touchTap( event:TouchEvent ):void

{

}

private function touchOut( event:TouchEvent ):void

{

}

private function touchRollOut( event:TouchEvent ):void

{

}

private function touchAdd( event:TouchEvent ):void

{

_touches[event.touchPointID] = event;

processTouchs()

Log.add('ADD:'+event.touchPointID)

if (event.stageY<50 && event.stageX>(stage.stageWidth-130))

{

Log.add('EXIT')

NativeApplication.nativeApplication.exit();

}

}

private function touchMove( event:TouchEvent ):void

{

_touches[event.touchPointID] = event;

processTouchs()

}

private function touchRemove( event:TouchEvent ):void

{

delete _touches[event.touchPointID];

processTouchs();

Log.add('REMOVE: ' + event.touchPointID + '');

}

private function processTouchs():void

{

var touch:TouchEvent;

var touchId:String;

var touches:Array = new Array();

var _touchesDistance:Array = new Array();

var touchA:TouchEvent;

var touchB:TouchEvent;

var nTouches:uint;

var nTouchesB:uint;

var matrix:Matrix;

for ( touchId in _touches )

touches.push(_touches[touchId]);

nTouches = touches.length;

graphics.clear();

_bitmapData.lock();

_bitmapData.fillRect(_bitmapData.rect , 0x0 );

while ( nTouches-- )

{

touchA = touches[nTouches];

nTouchesB = nTouches;

while ( nTouchesB-- )

{

touchB = touches[nTouchesB];

graphics.lineStyle( 1 , 0x68a4e1 , 1 );

graphics.moveTo( touchA.stageX , touchA.stageY );

graphics.lineTo( touchB.stageX , touchB.stageY );

var dx:Number = touchB.stageX - touchA.stageX;

var dy:Number = touchB.stageY - touchA.stageY;

var d:Number = SQRT(dx*dx+dy*dy);

_touchesDistance.push( { from:touchA.touchPointID , to:touchB.touchPointID , d:d } );

// draw the distances

_tf.defaultTextFormat = _format;

_tf.text = String(int(d));

matrix = new Matrix();

matrix.translate( (touchA.stageX + touchB.stageX - _tf.textWidth)*0.5  , (touchB.stageY + touchA.stageY - _tf.textHeight)*0.5  )

_bitmapData.draw( _tf , matrix );

}

drawTouch( touchA );

}

_bitmapData.unlock();

}

protected function onEnter( event:Event ):void

{

graphics.clear();

graphics.lineStyle( 1 , _colors[0] , 1 );

graphics.beginFill( _colors[0] , 1 );

graphics.drawCircle( mouseX , mouseY , 10 );

graphics.moveTo( 0,mouseY );

graphics.lineTo( stage.height,mouseY );

graphics.moveTo( mouseX,0 );

graphics.lineTo( mouseX,stage.width );

}

private function drawTouch( touch:TouchEvent ):void

{

var x:Number = touch.stageX;

var y:Number = touch.stageY;

var w:Number = touch.sizeX;

var h:Number = touch.sizeY;

var pressure:Number = touch.pressure;

var matrix:Matrix = new Matrix();

var rw:Number = w*500;

var rh:Number = h*500;

// draw lines

graphics.lineStyle( 1 , _colors[touch.touchPointID] , 1 );

graphics.moveTo( 0 , y );

graphics.lineTo( stage.height , y );

graphics.moveTo( x , 0 );

graphics.lineTo( x , stage.width );

// draw conctact area

rw = 100;

rh = 100;

//graphics.beginFill( _colors[touch.touchPointID] , 1 );

graphics.drawEllipse( x - rw/2 , y-rh/2 , rw , rh );

graphics.endFill();

matrix.translate( x - rw , y - rh )

_tf.defaultTextFormat = _formatId;

_tf.text = String(touch.touchPointID+1);

_bitmapData.draw( _tf , matrix );

}

}

}

TOPICS
Development

Views

582

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Multitouch primaryTouchPoint releases all touch points

New Here ,
Sep 04, 2017

Copy link to clipboard

Copied

We are currently developing an AIR app for desktop using Flex and AS3 in Flash Builder and we're running into an issue with multitouch annotations. The easiest way to replicate would be to draw a line using index finger. Whilst continuing to draw with index finger, press down middle finger and create a second line. Whilst both fingers are down release the index finger, both strokes stop drawing even though middle finger is still down and moving.

When I check which uniqueID's have been released in TouchEnd, removing the primary touch point will end all other uniqueID's also, effectively stopping multitouch until all touches are released and a new primary touch point is detected. This happens with any amount of touch points greater than 1.

On some systems we have noted that the strokes do continue, but performance is decreased dramatically (fps = 1). We have also noted that this is only an issue on Windows 8 and 10. To make this all even stranger, I have made a new app with just a multitouch canvas, tried examples of multitouch drawing apps from Adobe DevNet and others. All seem to have this issue.

The only time I've had any success is an ActionScript project that launched in Internet Explorer. When I used the same code in a new ActionScript project within FlashBuilder using AIR, we ran into the same issues as above. We are using AIR 26.0 and SDK's are up to date. Has anybody else ran into this issue?

The following is an example we found from "Char95 » Blog " which worked in internet explorer, but not in AIR:

package

{

import flash.display.*;

import flash.events.*;

import flash.text.*;

import flash.filters.BlurFilter;

import flash.geom.*

import flash.utils.*;

import flash.ui.*;

import com.char95.utils.*;

import flash.desktop.NativeApplication;

public class MultiTouchScreen extends Sprite

{

private const _touches:Object = new Object();

private const _touchesDistance:Array = new Array();

private const SQRT:Function = Math.sqrt;

protected const BMP_SCALE:Number = 1/2;

protected const DIM_AMT:Number = 1.015;

protected const DIM:ColorTransform = new ColorTransform(DIM_AMT, DIM_AMT, DIM_AMT);

protected var sourceBmp:BitmapData;

protected var colorBmp:BitmapData;

protected var fingerShape:Shape = new Shape();

protected var isMultitouch:Boolean = false;

protected var isMouseDown:Boolean = false;

private var _colors:Array = new Array(0xff0000,0x00ff00,0x0000ff,0xffff00,0xff00ff,0x00ffff);

private var _bitmapData:BitmapData;

private var _nTouches:uint = 0;

private var _font:Font = new AppFont();

private var _format:TextFormat = new TextFormat(_font.fontName, 30, 0x68a4e1); // text format

private var _formatId:TextFormat = new TextFormat(_font.fontName, 50, 0xffffff); // text format

private var _tf:TextField = new TextField();

public function MultiTouchScreen(wo:uint,ho:uint)

{

//_bitmapData = new BitmapData( 480 , 800 , true , 0x0 );

_bitmapData = new BitmapData( wo , ho , true , 0x0 );

try {

if (Multitouch.supportsTouchEvents)

{

Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;

isMultitouch = true;

}

Log.add('Multitouch device:'+Multitouch.supportsTouchEvents)

}

catch (error:ReferenceError)

{

Log.add("Sorry, but multitouch is not supported in this runtime.");

}

addEventListener ( Event.ADDED_TO_STAGE , addedToStage );

_tf.defaultTextFormat = _format;

_tf.autoSize = TextFieldAutoSize.LEFT;

_tf.multiline = false;

_tf.border = false;

_tf.borderColor = 0xff0000;

_tf.wordWrap = true;

_tf.selectable = false;

_tf.embedFonts = true;

_tf.antiAliasType = AntiAliasType.ADVANCED;

addChild(new Bitmap(_bitmapData));

}

protected function addedToStage( e:Event ):void

{

if (isMultitouch)

{

stage.addEventListener( TouchEvent.TOUCH_BEGIN , touchAdd );

stage.addEventListener( TouchEvent.TOUCH_MOVE , touchMove );

stage.addEventListener( TouchEvent.TOUCH_END , touchRemove );

stage.addEventListener( TouchEvent.TOUCH_OUT , touchOut );

stage.addEventListener( TouchEvent.TOUCH_ROLL_OUT , touchRollOut );

stage.addEventListener( TouchEvent.TOUCH_TAP , touchTap );

}

else

{

stage.addEventListener( MouseEvent.MOUSE_DOWN , function():void{isMouseDown = true} );

stage.addEventListener( MouseEvent.MOUSE_UP , function():void{isMouseDown = false} );

stage.addEventListener(Event.ENTER_FRAME, onEnter );

}

}

private function touchTap( event:TouchEvent ):void

{

}

private function touchOut( event:TouchEvent ):void

{

}

private function touchRollOut( event:TouchEvent ):void

{

}

private function touchAdd( event:TouchEvent ):void

{

_touches[event.touchPointID] = event;

processTouchs()

Log.add('ADD:'+event.touchPointID)

if (event.stageY<50 && event.stageX>(stage.stageWidth-130))

{

Log.add('EXIT')

NativeApplication.nativeApplication.exit();

}

}

private function touchMove( event:TouchEvent ):void

{

_touches[event.touchPointID] = event;

processTouchs()

}

private function touchRemove( event:TouchEvent ):void

{

delete _touches[event.touchPointID];

processTouchs();

Log.add('REMOVE: ' + event.touchPointID + '');

}

private function processTouchs():void

{

var touch:TouchEvent;

var touchId:String;

var touches:Array = new Array();

var _touchesDistance:Array = new Array();

var touchA:TouchEvent;

var touchB:TouchEvent;

var nTouches:uint;

var nTouchesB:uint;

var matrix:Matrix;

for ( touchId in _touches )

touches.push(_touches[touchId]);

nTouches = touches.length;

graphics.clear();

_bitmapData.lock();

_bitmapData.fillRect(_bitmapData.rect , 0x0 );

while ( nTouches-- )

{

touchA = touches[nTouches];

nTouchesB = nTouches;

while ( nTouchesB-- )

{

touchB = touches[nTouchesB];

graphics.lineStyle( 1 , 0x68a4e1 , 1 );

graphics.moveTo( touchA.stageX , touchA.stageY );

graphics.lineTo( touchB.stageX , touchB.stageY );

var dx:Number = touchB.stageX - touchA.stageX;

var dy:Number = touchB.stageY - touchA.stageY;

var d:Number = SQRT(dx*dx+dy*dy);

_touchesDistance.push( { from:touchA.touchPointID , to:touchB.touchPointID , d:d } );

// draw the distances

_tf.defaultTextFormat = _format;

_tf.text = String(int(d));

matrix = new Matrix();

matrix.translate( (touchA.stageX + touchB.stageX - _tf.textWidth)*0.5  , (touchB.stageY + touchA.stageY - _tf.textHeight)*0.5  )

_bitmapData.draw( _tf , matrix );

}

drawTouch( touchA );

}

_bitmapData.unlock();

}

protected function onEnter( event:Event ):void

{

graphics.clear();

graphics.lineStyle( 1 , _colors[0] , 1 );

graphics.beginFill( _colors[0] , 1 );

graphics.drawCircle( mouseX , mouseY , 10 );

graphics.moveTo( 0,mouseY );

graphics.lineTo( stage.height,mouseY );

graphics.moveTo( mouseX,0 );

graphics.lineTo( mouseX,stage.width );

}

private function drawTouch( touch:TouchEvent ):void

{

var x:Number = touch.stageX;

var y:Number = touch.stageY;

var w:Number = touch.sizeX;

var h:Number = touch.sizeY;

var pressure:Number = touch.pressure;

var matrix:Matrix = new Matrix();

var rw:Number = w*500;

var rh:Number = h*500;

// draw lines

graphics.lineStyle( 1 , _colors[touch.touchPointID] , 1 );

graphics.moveTo( 0 , y );

graphics.lineTo( stage.height , y );

graphics.moveTo( x , 0 );

graphics.lineTo( x , stage.width );

// draw conctact area

rw = 100;

rh = 100;

//graphics.beginFill( _colors[touch.touchPointID] , 1 );

graphics.drawEllipse( x - rw/2 , y-rh/2 , rw , rh );

graphics.endFill();

matrix.translate( x - rw , y - rh )

_tf.defaultTextFormat = _formatId;

_tf.text = String(touch.touchPointID+1);

_bitmapData.draw( _tf , matrix );

}

}

}

TOPICS
Development

Views

583

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Sep 04, 2017 0
stortof LATEST
New Here ,
Mar 22, 2018

Copy link to clipboard

Copied

We encounter the same issue even if we have a different way to make it occurs.

When we are moving 3 fingers on the screen for a long time (about 20 or 30 seconds) and then taping the screen with another finger, all the moving touches are lost. Then, until we remove all the fingers from the screen, only the last one that is put on the screen is detected...

To get Multitouch detection back we have no other solution exept removing all fingers from  the screen and we think there is there is no other workaround possible.

This is a major issue when you use physical objects that are detected on the screen because the app becomes unuable until you remove all the objects from the screen...

The issue occurs under Windows 10 and 8 with all AIR version we tested (from 19 to 29).

Help would be greatly appreciated.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 22, 2018 0