2009年12月25日 星期五

Multi Touch in Adobe AIR2 and Flash Player 10.1

Adobe 不久之後將可以支援 Multi Touch, 雖然是 beta version, 已經可以測試一下 (只要有 Multi Touch Device & Window 7)

MAX 2009 Develop Show Case:
http://tv.adobe.com/watch/max-2009-develop/multitouch-demos-in-adobe-air-2-and-flash-player-101/

Gesutre Samples:
http://www.adobe.com/devnet/flash/articles/multitouch_gestures.html

 TouchEvent help Docs:
http://help.adobe.com/en_US/FlashPlatform/beta/reference/actionscript/3/flash/events/TouchEvent.html

寫法十分簡易, 如果你已經熟悉AS3, 應該不是甚麼困難的東西
Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;

MySprite.addEventListener(TouchEvent.TOUCH_BEGIN, onTouchBegin);
MySprite.addEventListener(TouchEvent.TOUCH_MOVE, onTouchMove);
MySprite.addEventListener(TouchEvent.TOUCH_END, onTouchEnd);

function onTouchBegin(eBegin:TouchEvent) {
     eBegin.target.startTouchDrag(eBegin.touchPointID, false, bg.getRect(this));
     trace("touch begin");
 
 }

function onTouchMove(eMove:TouchEvent) {
    trace(eMove.stageX);
}
 
function onTouchEnd(eEnd:TouchEvent) {
     eEnd.target.stopTouchDrag(eEnd.touchPointID);
     trace("touch end");
}

沒有留言:

張貼留言