MultitouchInputMode
Hi people - I build an app that is essentially a 'puzzle' - IE where you have the parts you need to get into the other rooms. This means that individual parts must be able to be moved and rotation.
Question: is it possible for a program to listen for the TWO flash.ui.Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT [(alors qu'un seul doigt peut être programmé pour déplacer la pièce de puzzle), AND flash.ui.Multitouch.inputMode = MultitouchInputMode.GESTURE (so that an action of "rotate" of two fingers can turn a piece of the puzzle.] I guess I could program listeners in mode TOUCH_POINT to watch for an event of type rotation, but I hope that there is some automatic events that can be triggered.
Thank you.
Jim
Jimmy,
When Multitouch.inputMode is set to GESTURE, you will not receive the TouchEvent event, but you can still listen to the events of MouseEvent - upward, low, move, click etc. These events are sometimes slightly delayed (so that the logic of gesture can determine if they are part of a gesture) or cancelled (if it turns out that they are part of a gesture).
Cheers, - Jon-
Tags: BlackBerry Developers
Similar Questions
-
Determine a diagonal move with MultitouchInputMode.GESTURE?
How can I determine a diagonal move with MultitouchInputMode.GESTURE?
Hello
You calculate that it based on the sense of the offsetX and offsetY.
Say you are listening to the TransformGestureEvent.GESTURE_SWIPE. offsetX indicates left/right-1 left and 1 right. offsetY indicate high-low with 1 for down and-1 for upward. So if it is of 1/offsetX and offsetY is 1, you went right down to the right.
It depends on what you are trying to detect. See the documentation for the TransformGestureEvent and see if any of these events gives you the values you want.
If you need more in detail that you have to roll your own "gesture" by opting for the touch events monitoring and calculation in this way.
iBrent
-
Can I convert TimerEvent MultitouchInputMode?
Hi all I am trying to create an app for android (spaceinvaders) siple and I created a TimerEvent for laser
This is the code
___________
Create a timer that executes a function every second 1/2
var laserTimer:Timer = new Timer (500);
laserTimer.addEventListener (TimerEvent.TIMER, timerListener);
function timerListener(e:TimerEvent):void
{
In the binding for a movieclip library should be Laser
var tempLaser:MovieClip = new Laser();
Place the laser at the edge of the ship of the pla5er
tempLaser.x = player.x + (player.width/2);
tempLaser.y = player.y;
tempLaser.speed = 10;
Lasers.push (tempLaser);
addChild (tempLaser);
Sound: sound var = new shoot();
Sound.play();
}
Table of lasers is necessary;
function moveLaser (): void
{
Laser displacement
var tempLaser:MovieClip;
for (var i = Lasers.length - 1; i > = 0; i--)
{
tempLaser = Lasers [i];
tempLaser.y = tempLaser.speed;
If (tempLaser.y < 0)
{
Delete 1 table of Lasers laser;
removeLaser (i);
}
}
Delete all tempExplosion table of explosions that has already played;
var tempExplosion:MovieClip;
for (i = explosions.length - 1; i > = 0; i--)
{
tempExplosion = explosions [i];
If (tempExplosion.currentFrame > = tempExplosion.totalFrames)
{
removeExplosion (i);
}
}
}
____
now I ask convert this little piece of code a Multitouch event is the codeMultitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
movieClip_1.addEventListener (TouchEvent.TOUCH_TAP, fl_TapHandler);
function fl_TapHandler(event:TouchEvent):void
{
code
}
_____
What should I do if it ' possible?
tnks a lot at all
then delete all of the code in the timer and use:
Create a timer that executes a function every second 1/2
stage.addEventListener (TouchEvent.TOUCH_TAP, timerListener);
function timerListener(event:TouchEvent):void
{
In the binding for a movieclip library should be Laser
var tempLaser:MovieClip = new Laser();
Place the laser at the edge of the ship of the pla5er
tempLaser.x = player.x + (player.width/2);
tempLaser.y = player.y;
tempLaser.speed = 10;
Lasers.push (tempLaser);
addChild (tempLaser);
Sound: sound var = new shoot();
Sound.play();
}
-
Respond to touch simultaneously
Hello world
I have 3 HSlider in my Flex app, and I would like the user to be able to drag them all together (simultaneously).
The problem now is that when the user is dragging a HSlider, the application does not meet the second touch on the other HSlide (user can only drag a cursor at a time)
How would I be able to allow the user to drag several cursor at the same time?
Thank you!!
I tried
Multitouch.inputMode=MultitouchInputMode.TOUCH_POINT; AND Multitouch.inputMode=MultitouchInputMode.GESTURE;
But it still does not work...
First of all, you need to set the inputMode:
Multitouch.inputMode=MultitouchInputMode.TOUCH_POINT;
And then you have to write your own slider component. The default HSliders are built to meet MouseEvents and therefore will not work with multitouch.
-
Hi guys,.
Just need a bit of help - I hope its fairly simple:
I have three buttons with sound effects in a mobile adobe air device (PlayBook in this case - supports up to 4-point multitouch).
All buttons work, but how I let the user press all three at the same time? Is there another way to do this?
Thank you
First, you must assign the in support of multitouch input mode:
Multitouch.inputMode=MultitouchInputMode.TOUCH_POINT;
Then, it depends on the component you are using if it works out of the box. You may customize or write your own button.
-
Someone there to work on the Playbook? Is there a setting I need to turn it on so that it? I tried to listen to (on the label of a button and on "cela"), but nothing seems to be cooking for me. I've been tesitng on the device, so it * should * work, but no luck so far.
You do 'Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;'?
-
What is the correct code for the sweep feature or is there a qnx based?
==============
import flash.events.TransformGestureEvent;
Multitouch.inputMode = MultitouchInputMode.GESTURE;
stage.addEventListener (TransformGestureEvent.GESTURE_SWIPE, fl_turnPage);function fl_turnPage(event:TransformGestureEvent): void
{
if(Event.OffsetX == 1)
{
prevFrame();
}
ElseIf (event.offsetX == - 1).
{
nextFrame();
}
}Currently, you can not test gestures multitouch on the playbook. the Simulator is not now allow us to do so. you will have to wait for the current device or wait for a more equipped Simulator is released.
-
Detect the finger leaves the scene
Hi all
I have an object in my scene which can be dragged around. He listens to event mouse_down and begins after the mouse/finger on each mouse_move event until he recorded a mouse_up event.
How can I detect when the user's finger leaves the side of the screen? Currently, if a user drags on the side of the screen and raises their finger, no mouse_up case is never raised and the subject thinks it's still inappropriate. Thus, there is a mouse_leave event which should do what I want, but seems not to relax.
Ideally, I'd like that behavior, for example the browser - movement still works on the bezel, and if the user swipes too far the application can sign up for an event and act as if the finger was lifted.
Please let me know if anyone can suggest a solution or if it is simply not possible in the air.
Thank you
BrandonI found the solution to this problem, and as it is the spirit in the forums, I will share my solution for future use.
The problem is that MouseEvents are not triggered properly when moving outside the [0,0] to [1 023 599] screen coordinates. The solution is to use the multipoint touch input rather than detect mouse events.
(1) import the right classes:
flash.ui import. *;
(2) turn followed multitouch of entry (add this to your Builder):
flash.ui.Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
(3) allow the capture of the event:
ship.addEventListener (TouchEvent.TOUCH_BEGIN, press_start);
stage.addEventListener (TouchEvent.TOUCH_MOVE, press_moved);
stage.addEventListener (TouchEvent.TOUCH_END, press_end);(4) for each of the press_start, press_moved and press_end fuctions, add the following code to ensure that the use of multiple fingers is not screw up:
If (event.isPrimaryTouchPoint == false) Then return
Works like a charm!
-
How to drag a particular area only in the Air for IOS
Dear friends,
IAM, creating an app for iOS using Air and AS3. I have a band below my screen I put buttons to click and go to private lessons. IAM creating striking swipe for these buttons. I have this code below:
Multitouch.inputMode = MultitouchInputMode.GESTURE;
stage.addEventListener (TransformGestureEvent.GESTURE_SWIPE, fl_SwipeHandler);
function fl_SwipeHandler(event:TransformGestureEvent):void
{
Switch (Event.OffsetX)
{
slipped right
case 1:
{
sw_area. Buttons.x += 20;
break;
}
slid left
box - 1:
{
sw_area. Buttons.x-= 20;
break;
}
}
}
The code above makes the buttons inside the box to slide to move while sliding on the stage... I want the user to swipe Strip area available instantly drag and drop buttons. If the user swipes on the stage should not move. How can I do? pls help me friends.
I changed as
sw_area.addEventListener (TransformGestureEvent.GESTURE_SWIPE, fl_SwipeHandler);
It does not work. pls help me solve this problem.
Thanks in advance,
Syed Abdul Rahim
Hi friends,
I've solved, can be usful to others... I used stageY to the control.
Multitouch.inputMode = MultitouchInputMode.GESTURE;
stage.addEventListener (TransformGestureEvent.GESTURE_SWIPE, fl_SwipeHandler);
function fl_SwipeHandler(event:TransformGestureEvent):void
{
Switch (Event.OffsetX)
{
slipped right
case 1:
{
If {(event.stageY > 650)
sw_area. Buttons.x += 20;
}
break;
}
slid left
box - 1:
{
If {(event.stageY > 650)
sw_area. Buttons.x-= 20;
}
break;
}
}
}
-
How function active scan to previous frame?
I use the script below, the problem is the function to the previous image did not work, his command always at the last picture, please help me, tq
* to frame 1
Multitouch.inputMode = MultitouchInputMode.GESTURE;
stage.addEventListener (TransformGestureEvent.GESTURE_SWIPE, fl_SwipeToGoToNextPreviousScene_a);
function fl_SwipeToGoToNextPreviousScene_a(event:TransformGestureEvent):void
{
if(Event.OffsetX == 1)
{
slipped right
Stop();
}
ElseIf (event.offsetX == - 1).
{
slid left
gotoAndPlay (2);
}
}
*-field of 10
Multitouch.inputMode = MultitouchInputMode.GESTURE;
stage.addEventListener (TransformGestureEvent.GESTURE_SWIPE, fl_SwipeToGoToNextPreviousScene_b);
function fl_SwipeToGoToNextPreviousScene_b(event:TransformGestureEvent):void
{
if(Event.OffsetX == 1)
{
slipped right
gotoAndPlay (2);
}
ElseIf (event.offsetX == - 1).
{
slid left
gotoAndPlay (11);
}
}
*-field of 20
Multitouch.inputMode = MultitouchInputMode.GESTURE;
stage.addEventListener (TransformGestureEvent.GESTURE_SWIPE, fl_SwipeToGoToNextPreviousScene_c);
function fl_SwipeToGoToNextPreviousScene_c(event:TransformGestureEvent):void
{
if(Event.OffsetX == 1)
{
slipped right
gotoAndPlay (11);
}
ElseIf (event.offsetX == - 1).
{
slid left
gotoAndPlay (21);
}
}
*-field of 40
Multitouch.inputMode = MultitouchInputMode.GESTURE;
stage.addEventListener (TransformGestureEvent.GESTURE_SWIPE, fl_SwipeToGoToNextPreviousScene_d);
function fl_SwipeToGoToNextPreviousScene_d(event:TransformGestureEvent):void
{
if(Event.OffsetX == 1)
{
slipped right
gotoAndPlay (21);
}
ElseIf (event.offsetX == - 1).
{
slid left
gotoAndStop (40);
}
}
Use removeEventListener to remove event listeners. for example,.
stage.removeEventListener (TransformGestureEvent.GESTURE_SWIPE, fl_SwipeToGoToNextPreviousScene_a);
-
App works in control >; TestMovie >; DebugLauncherMobile but not for Mobile device
This is supposed to be a very simple application of "press here and it made a noise of."
When I use the control > test movie > Debug Launcher Mobile > touch and gestures > Touch layer... .She works perfectly.
But when I publish and export the installer to windows... the button plays no noise when they are hit.
Here's the code. Help please.
Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
circle.addEventListener (TouchEvent.TOUCH_TAP, fl_ClickToPlayStopSound);
var fl_SC:SoundChannel;
This variable keeps track of whether you want to start or stop the sound
var fl_ToPlay:Boolean = true;
function fl_ClickToPlayStopSound(evt:TouchEvent):void
{
If (fl_ToPlay)
{
var s:Sound = new Sound (new URLRequest("Belly.mp3"));
fl_SC = s.play ();
}
on the other
{
fl_SC. Stop();
}
fl_ToPlay =! fl_ToPlay;
}
Use the debug > debug movie > debugging usb test option.
(p.s. Make sure that Belly.mp3 is in your control panel "included files" in the air for android/ios parameters.)
-
Hello
I'm looking for a zoom in zoom out gesture.
It's AS3 code that I want to convert in AS2
Multitouch.inputMode = MultitouchInputMode.GESTURE;
elephant.addEventListener (TransformGestureEvent.GESTURE_ZOOM, onZoom);
elephant.addEventListener (TransformGestureEvent.GESTURE_ROTATE, onRotate);
private void onZoom(e:TransformGestureEvent):void
{
var elephant: Sprite = e.target as Sprite;
elephant.scaleX * = e.scaleX;
elephant.scaleY * = e.scaleY;
}
private void onRotate(e:TransformGestureEvent):void
{
var elephant: Sprite = e.target as Sprite;
Elephant.rotation += e.rotation;
}
no such thing in as2. You can't publish even for touch devices like ios and android with as2.
-
IF statement at the end of the game
So basically, I have a button that moves to a random location on the screen based on a timer. What happens if the statement would be correct at the end of the game, if the person does not click on the button before it moves to the new location? Thank you!!
All my code!
import flash.utils.Timer;
import flash.events.TimerEvent;
Stop();
var timmyTimer:Timer = new Timer (3000)
var score: int = 0;
timmyTimer.addEventListener (TimerEvent.TIMER, tick)
Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
timmyTimer.start ();
function tick(t:TimerEvent):void {}
If {(t.target.delay > 500)
t.Target.Delay = 100; }
addChild (mcBall);
mcBall.x = Math.floor (Math.random () *(stage.stageWidth-mcBall.width));
mcBall.y = Math.floor (Math.random () *(stage.stageHeight-mcBall.height));
mcBall.nextFrame ();
}
Stop();
mcBall.addEventListener (TouchEvent.TOUCH_TAP, fl_TapHandler);
function fl_TapHandler(event:TouchEvent):void {}
timmyTimer.reset ();
score += 1;
updateScores();
mcBall.x = Math.floor (Math.random () *(stage.stageWidth-mcBall.width));
mcBall.y = Math.floor (Math.random () *(stage.stageHeight-mcBall.height));
mcBall.nextFrame ();
removeChild (mcBall);
timmyTimer.stop ();
timmyTimer.reset ();
}
function updateScores (): void {}
lblScore.text = String (score);
}
function endGame (): void {}
timmyTimer.stop ();
gotoAndStop (3);
mcBall.removeEventListener (TouchEvent.TOUCH_TAP, fl_TapHandler);
removeEventListener (TimerEvent.TIMER, tick);
removeEventListener (TouchEvent.TOUCH_TAP, fl_TapHandler);
removeChild (mcBall);
}
-
So, Go to Previous stage and play Air for iOS
Hi, I use this script action to create a simple touch App.
/ * Move to go to the next or previous scene - and Play
Drag the scene moves the playhead to the previous scene in the timeline and keep reading of this scene.
*/
Multitouch.inputMode = MultitouchInputMode.GESTURE;
stage.addEventListener (TransformGestureEvent.GESTURE_SWIPE, fl_SwipeToGoToNextPreviousScene_5);
function fl_SwipeToGoToNextPreviousScene_5(event:TransformGestureEvent):void
{
if(Event.OffsetX == 1)
{
slipped right
prevScene();
}
ElseIf (event.offsetX == - 1).
{
slid left
nextScene();
}
}
It works fine if I did only two scenes, but I have more than that. For now, it will be reset at the beginning and not pass the stage 2.
Should I change this code here?
if(Event.OffsetX == 1)
{
slipped right
prevScene();
}
ElseIf (event.offsetX == - 1).
{
slid left
nextScene();
}
}
Any advice would be helpful.
Thank you
You must add a stop() in each scene.
-
Is it possible to use the GESTURE and TOUCH_POINT together?
Hello!
I wonder if there is a way to use the GESTURE and TOUCH_POINT together in a flash mobile app (Android).
I want a specific graphic object to respond to the TOUCH_POINT (i.e.: type on and drag) and specific gestures (i.e.: two fingers to Zoom).
but notice that each one requires a different configuration to the global variable Multitouch.inputMode setting:
TOUCH_TAP faucet requires:
Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
where GESTURE_ZOOM requires:
Multitouch.inputMode = MultitouchInputMode.GESTURE;
I know it's possible in mobile applications, for example see GoogleMaps.
But I wonder is it possible using Flash and Adobe Air...
Thank you
Koby
I found a solution!
Instead of TOUCH_TAP use MouseEvent.CLICK and then you can use the GESTURE to the Multitouch.inputMode.
p.s.: For the long pressure feature: instead of TouchEvent.TOUCH_BEGIN use MouseEvent.MOUSE_DOWN
and instead of TouchEvent.TOUCH_END / TouchEvent.TOUCH_OUT / TouchEvent.TOUCH_ROLL_OUT use MouseEvent.MOUSE_UP)
For all those who may need this...
Koby
Maybe you are looking for
-
I have an iPhone 4S which I inherited from my son. I would like to sync the iPhone to my MacBook (OS X 10.6.8) 2.1 with iTunes 11.4, but when I plug my iPhone into the MacBook SB, I get a notification that I have to update my iTunes to the latest ve
-
In collaboration with the binary.
I need to check if there is an easier way to do that I think. If I have an 8-bit binary (i.e. 10111001) entry, I need to check if each individual bits are high '1' or '0' low. My first thought was to start the individual bits but that it becomes mess
-
Can I install XP from a computer die on "newer" computer
I recently got a new laptop at work. My home computer died a year before, so I need a new. The computer dead was built by the wife of a former colleague, and I have no more contact with one of them. My employer will let me buy my old lap top, at a
-
C:\Users\owner\AppData\Local\egaluxocaciris.dll
I get this error message after Windows starts.
-
WeatherBug on Windows7 desktop
Recently uploaded files/settings from XP to a 'new' W7 refurbished machine. Downloaded WeatherBug. When I click to view info everything is fine but when I close or reduce the window part of background remains. The only way to remove it is to click