Livecode has also incorporated a system to manage multitouch without limit to the number of fingers that can be used simultaneously. This system works on Android and iOS.
The messages to be intercepted are: touchStart, touchMove and touchEnd.
For each of us we have a disposition a unique identifier (tID) of the finger a contact with the screen, which is presented by a number.
- touchStart is sent as soon as a finger touches the screen
- touchMove is sent when a finger scrolls across the screen, including the position (X, Y) of the finger
- touchEnd is sent as soon as a finger comes off the screen
on touchstart tID lock screen create field ("finger" & tID) set the width of the field ("dito" & tID) to 250 put "1," & (22 * tID) into temp #posizione set the topleft of the field ("dito" & tID) to temp create graphic ("finger" & tID) set the opaque of graphic ("finger" & tID) to True set the style of graphic ("finger" & tID) to oval put (25 * tID) & comma & (25 * tID) & comma & (25 * tID) into temp #colore set the backgroundcolor of graphic ("finger" & tID) to temp set the width of graphic ("finger" & tID) to 30 set the height of graphic ("finger" & tID) to 30 unlock screenend touchstart
on touchend tID delete field ("finger" & tID) delete graphic ("finger" & tID)end touchend
on touchmove tID, tX, tY set the text of field ("dito" & tID) to ("il dito " & tID & " si trova in " & tX & comma & tY) set the loc of graphic ("dito" & tID) to (tX & comma & tY)end touchmoveThis is the result on a Android device:

No comments:
Post a Comment