How to get coordinates of two touch points simultaneously? AS3 AIR


#1

Dear All,

After my researches, I prepare a simple .fla. I try to write two touch points coordinates simultaneously. To separate 1th and 2th touches, I used TouchID odd even condition simultaneously. But I couldnt achieve that. My example is on attachment. And I wrote the script below. Is anybody knows an idea? Thanks.

Question1.fla (5.2 KB)

Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;

var curTouchPoints:Dictionary = new Dictionary();

stage.addEventListener(TouchEvent.TOUCH_BEGIN, touchStart);

stage.addEventListener(TouchEvent.TOUCH_MOVE, touchMove);

function touchStart(e:TouchEvent):void
{
	curTouchPoints[e.touchPointID] = {obj:e.currentTarget,offsetX:e.localX,offsetY:e.localY};
	e.currentTarget.addEventListener(TouchEvent.TOUCH_END,touchEnd);
}

function touchMove(e:TouchEvent):void
{
	if (e.touchPointID % 2 == 0)
	{
		TouchX1.text = "" + e.stageX;
		TouchY1.text = "" + e.stageY;
	}
	else if (e.touchPointID % 2 != 0)
	{
		TouchX2.text = "" + e.stageX;
		TouchY2.text = "" + e.stageY;
	}
}

function touchEnd(e:TouchEvent):void
{
	delete curTouchPoints[e.touchPointID];
	e.currentTarget.removeEventListener(TouchEvent.TOUCH_END,touchEnd);
}

#2

There is no problem. Because the problem is text fields needs embeding numerals and punctiations. After adding embed operation text fields works correctly.

Thanks.