Touch Flash action script 3

Asked

Viewed 48 times

1

Why does this happen?

I created a circle convert it to BUTTON, and 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.

1 answer

0

For touch events, you must set what the type of touch your application will receive. Actionscript provides three types:

  1. GESTURE You make a move and it takes an action)
  2. NONE Touch is treated as mouse click
  3. TOUCH_POINT Each touch you give on the screen is generated 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 Ids of the touches that are made by the user, you must read the property touchPointID of the object TouchEvent, thus:

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

At this link there are all references to treat screen touches. If you can’t, make sure the device you’re testing your application supports multitouch, some read only one, this site can help.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.