Skip to main content
Participant
September 20, 2011
Question

MouseEvent and TouchEvent not working on HTC phones

  • September 20, 2011
  • 3 replies
  • 719 views

Hi,

I am using both touchEvent and mouseEvent in my application.

TouchEvent for scrolling the screen and MouseEvent for link.

its working well on Galaxy series but not working on HTC phones.

here is the part of code:

img1.addEventListener(MouseEvent.CLICK, gzt1);

img2.addEventListener(MouseEvent.CLICK, gzt2);

img3.addEventListener(MouseEvent.CLICK, gzt3);

img4.addEventListener(MouseEvent.CLICK, gzt4);

img5.addEventListener(MouseEvent.CLICK, gzt5);

img6.addEventListener(MouseEvent.CLICK, gzt6);

stage.addEventListener(TouchEvent.TOUCH_BEGIN, onTouchBegin);

stage.addEventListener(TouchEvent.TOUCH_MOVE, onTouchMove);

stage.addEventListener(TouchEvent.TOUCH_END, onTouchEnd);

function onTouchBegin(event:TouchEvent) {

   // mySprite.mouseEnabled= false;

    //mySprite.mouseChildren= false;

    currenty = event.stageY;

}

function onTouchMove(event:TouchEvent) {

    mySprite.mouseEnabled= false;

    mySprite.mouseChildren= false;

    if(event.stageY<currenty){   

            mySprite.y -=10;   

        }else if(event.stageY>currenty){           

            mySprite.y +=10;

        }

       

}

function onTouchEnd(event:TouchEvent) {

     mySprite.mouseEnabled= true;

     mySprite.mouseChildren= true;

    if(mySprite.y>0){

        mySprite.y = 0;

    }else if(mySprite.y<(newsy-(5*sx/3))){

        mySprite.y = (newsy-(5*sx/3));

    }

}

This topic has been closed for replies.

3 replies

Adobe Employee
September 20, 2011

Could you please elaborate on what part is not working? Does any of the touch event handlers get called? Do the mouse event handlers get called?

Also, what has MultiTouch.inputMode been set to?

berk_chAuthor
Participant
September 20, 2011

Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;

If i use only mouseEvent, it is working well. When i add touchEvent, touchEvent handlers get called, but mouseEvent handlers not on HTC phones.

Adobe Employee
September 20, 2011

Mouse events would be received irrespective of the multitouch input mode for the primary touch point. For all subsequent touches there would not be any mouse events.

When the multi-touch input mode is set to TOUCH_POINT, you should receive TouchEvents for all the touch points and mouse events for the primary touch point. This behaviour should be consistent on all devices.

If you are seeing a behaviour that is different from the above on any one device then please share the complete source code that you are working with (or a subset of it but fully working on one device and not on another).

Regards

Divij

(AIR Engineering)