API Docs for: 最后更新日期:2014年8月25日
Google搜索   
Show:

LMultitouch Class

Defined in: ui/LMultitouch.js:1

Available since 1.8.9 LInit(1000/50,"legend",800,450,main); var layer,backLayer,touchPointIDList = []; function main () { if(LGlobal.canTouch){ LGlobal.stageScale = LStageScaleMode.EXACT_FIT; LSystem.screen(LStage.FULL_SCREEN); } LMultitouch.inputMode = LMultitouchInputMode.TOUCH_POINT; layer = new LSprite(); layer.graphics.drawRect(2,"#ffffff",[0,0,LGlobal.width,LGlobal.height],true,"#ffffff"); addChild(layer); backLayer = new LSprite(); backLayer.y = 50; layer.addChild(backLayer); var txtLabel = new LTextField(); txtLabel.size = 18; txtLabel.x = 10; txtLabel.y = 5; layer.addChild(txtLabel); if(!LGlobal.canTouch){ txtLabel.text = "多点触屏测试:请用手机或平板电脑测试"; }else{ txtLabel.text = "多点触屏测试:请点击屏幕进行测试"; } layer.addEventListener(LMouseEvent.MOUSE_DOWN,addTouchPointID); layer.addEventListener(LMouseEvent.MOUSE_MOVE,addTouchPointID); layer.addEventListener(LMouseEvent.MOUSE_UP,removeTouchPointID); } function addTouchPointID(e){ var f = false; for(var i=0;i<touchPointIDList.length;i++){ if(touchPointIDList[i].touchPointID == e.touchPointID){ touchPointIDList[i] = e; f = true; break; } } if(!f)touchPointIDList.push(e); draw(); } function removeTouchPointID(e){ for(var i=0;i<touchPointIDList.length;i++){ if(touchPointIDList[i].touchPointID == e.touchPointID){ touchPointIDList.splice(i,1); break; } } draw(); } function draw(){ backLayer.removeAllChild(); for(var i=0;i<touchPointIDList.length;i++){ var eve = touchPointIDList[i]; var title = new LTextField(); title.text = "id:"+eve.touchPointID+","+eve.offsetX+","+eve.offsetY; title.size = 18; title.x = 10; title.y = i*23; backLayer.addChild(title); } }

LMultitouch クラスは、現在の環境でのユーザーによる入力デバイス操作の処理のサポートに関する情報の管理と提供を行います。複数のタッチポイント(ユーザーが複数の指でタッチスクリーンに触れるなど)が可能な入力デバイスが含まれます。タッチスクリーン搭載の携帯電話またはタブレットなどのデバイスを操作する場合、ユーザーは通常、指やポインティングデバイスで画面に触れます。ポインティングデバイスにはマウスやスタイラスなど様々な種類のものがありますが、これらのデバイスの多くは、アプリケーションでの接触ポイントは 1 つだけです。接触ポイントが 1 つだけのポインティングデバイスでは、ユーザーの操作イベントは、マウスイベントとしてか、タッチイベント("タッチポイント" イベントと呼ばれる)の基本セットを使用したものとして扱うことができます。

Constructor

LMultitouch

() public

Defined in ui/LMultitouch.js:1

Available since 1.8.9 LInit(1000/50,"legend",800,450,main); var layer,backLayer,touchPointIDList = []; function main () { if(LGlobal.canTouch){ LGlobal.stageScale = LStageScaleMode.EXACT_FIT; LSystem.screen(LStage.FULL_SCREEN); } LMultitouch.inputMode = LMultitouchInputMode.TOUCH_POINT; layer = new LSprite(); layer.graphics.drawRect(2,"#ffffff",[0,0,LGlobal.width,LGlobal.height],true,"#ffffff"); addChild(layer); backLayer = new LSprite(); backLayer.y = 50; layer.addChild(backLayer); var txtLabel = new LTextField(); txtLabel.size = 18; txtLabel.x = 10; txtLabel.y = 5; layer.addChild(txtLabel); if(!LGlobal.canTouch){ txtLabel.text = "多点触屏测试:请用手机或平板电脑测试"; }else{ txtLabel.text = "多点触屏测试:请点击屏幕进行测试"; } layer.addEventListener(LMouseEvent.MOUSE_DOWN,addTouchPointID); layer.addEventListener(LMouseEvent.MOUSE_MOVE,addTouchPointID); layer.addEventListener(LMouseEvent.MOUSE_UP,removeTouchPointID); } function addTouchPointID(e){ var f = false; for(var i=0;i<touchPointIDList.length;i++){ if(touchPointIDList[i].touchPointID == e.touchPointID){ touchPointIDList[i] = e; f = true; break; } } if(!f)touchPointIDList.push(e); draw(); } function removeTouchPointID(e){ for(var i=0;i<touchPointIDList.length;i++){ if(touchPointIDList[i].touchPointID == e.touchPointID){ touchPointIDList.splice(i,1); break; } } draw(); } function draw(){ backLayer.removeAllChild(); for(var i=0;i<touchPointIDList.length;i++){ var eve = touchPointIDList[i]; var title = new LTextField(); title.text = "id:"+eve.touchPointID+","+eve.offsetX+","+eve.offsetY; title.size = 18; title.x = 10; title.y = i*23; backLayer.addChild(title); } }

Item Index

Properties

Properties

inputMode

String public

Defined in ui/LMultitouch.js:71

Available since 1.8.9

タッチおよびジェスチャイベントを扱うマルチタッチモードを識別します。このプロパティを設定するには、LMultitouchInputMode クラスの値を使用します。

Default: none