Touch Flash action script 3

1

Why does this happen?

I created a circle that converted it into a BUTTON, and I give it any action, if I leave one of my fingers pressed on the screen outside the circle, and touch it with my other finger it does not perform any kind of action.

    
asked by anonymous 03.06.2015 / 14:19

1 answer

0

For touch events, you must set the touch type that your application will receive. ActionScript provides three types:

  • GESTURE You make a move and it takes action)
  • NONE Touch is treated as mouse click
  • TOUCH_POINT Each touch you give on the screen generates a "touchID" for manipulation.
  • ( ref .)

    The default is GESTURE, so to set more than one touch on the screen, you should use:

    Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
    

    And then, to handle the events:

    botao.addEventListener(TouchEvent.TOUCH_BEGIN, comecouTocar); //Início
    botao.addEventListener(TouchEvent.TOUCH_END, terminouTouch); //Término
    botao.addEventListener(TouchEvent.TOUCH_MOVE, moveTouch); //Movimento
    botao.addEventListener(TouchEvent.TOUCH_TAP, toqueTouch); //Toque (Equivalente ao MOUSE_CLICK)
    .............
    

    To read the touch IDs that are made by the user, you should read the touchPointID property of the object TouchEvent , like this:

    function toqueTouch(e:TouchEvent):void {
        trace(e.touchPointID); //ID do toque do usuário
    }
    

    In this link there are all references to handle touches on the screen. If you can not, make sure the device you're testing your application supports multi-touch, some read only one, this site can help.

        
    06.06.2015 / 16:58