class T_touchMove extends egret . DisplayObjectContainer { /**
     * 演示对象的跟随手指移动事件
     */ public constructor ( ) { super ( ) ; var draggedObject ; var offsetX ; var offsetY ; var circle = new egret . Shape ( ) ; circle . graphics . beginFill ( 0xff0000 ) ; circle . graphics . drawCircle ( 25 , 25 , 25 ) ; circle . graphics . endFill ( ) ; this . addChild ( circle ) ; var square = new egret . Shape ( ) ; square . graphics . beginFill ( 0x0000ff ) ; square . graphics . drawRect ( 0 , 0 , 100 , 100 ) ; square . graphics . endFill ( ) ; this . addChild ( square ) ; circle . touchEnabled = true ; circle . addEventListener ( egret . TouchEvent . TOUCH_BEGIN , startMove , this ) ; circle . addEventListener ( egret . TouchEvent . TOUCH_END , stopMove , this ) ; square . touchEnabled = true ; square . addEventListener ( egret . TouchEvent . TOUCH_BEGIN , startMove , this ) ; square . addEventListener ( egret . TouchEvent . TOUCH_END , stopMove , this ) ; function startMove ( e ) { draggedObject = e . currentTarget ; offsetX = e . stageX - draggedObject . x ; offsetY = e . stageY - draggedObject . y ; this . addChild ( draggedObject ) ; this . stage . addEventListener ( egret . TouchEvent . TOUCH_MOVE , onMove , this ) ; } function stopMove ( e ) { console . log ( 22 ) ; this . stage . removeEventListener ( egret . TouchEvent . TOUCH_MOVE , onMove , this ) ; } function onMove ( e ) { draggedObject . x = e . stageX - offsetX ; draggedObject . y = e . stageY - offsetY ; } } }