Multitouch gesture swipe and zoom
Hi,
I seem to have a conflict between two gesture events I'm trying to use - Swipe and Zoom.
I have a movie clip on frame one of the main timeline which has 4 items and it swipes perfectly left and right.
That works fine until I try to add a zoom function to an image of frame 25 of the same/main timeline.
If I test the movie, I can swipe the first movie no problem. Then if I navigate to frame 25 I can pinch/zoom on the image on that framed.
But when I navigate back to the swipe gallery it doesn't work.
I'm using the code snippets but these two functions don't seem to like working together in the same file.
Can someone please tell me what I'm doing wrong.
Thanks
============== Here's what I'm using for the Swipe function on frame 1 ==================================
Multitouch.inputMode = MultitouchInputMode.GESTURE;
var currentGalleryItem:Number = 1;
var totalGalleryItems:Number = 4;
gallery_items.addEventListener (TransformGestureEvent.GESTURE_SWIPE, fl_SwipeToGoToNextPreviousFrame);
function fl_SwipeToGoToNextPreviousFrame(event:TransformGestureEvent):void
{
if(event.offsetX == 1)
{
if(currentGalleryItem > 1){
currentGalleryItem--;
slideRight();
}
}
else if(event.offsetX == -1)
{
if(currentGalleryItem < totalGalleryItems){
currentGalleryItem++;
slideLeft();
}
}
}
var slideCounter:Number = 0;
function slideLeft(){
gallery_items.addEventListener("enterFrame", moveGalleryLeft);
}
function slideRight(){
gallery_items.addEventListener("enterFrame", moveGalleryRight);
}
function moveGalleryLeft(evt:Event){
gallery_items.x -= 48;
slideCounter++;
if(slideCounter == 10){
gallery_items.removeEventListener("enterFrame", moveGalleryLeft);
slideCounter = 0;
}
}
function moveGalleryRight(evt:Event){
gallery_items.x += 48;
slideCounter++;
if(slideCounter == 10){
gallery_items.removeEventListener("enterFrame", moveGalleryRight);
slideCounter = 0;
}
}
============== Here's what I'm using for the pinch/zoom function on frame 25 ==================================
Multitouch.inputMode = MultitouchInputMode.GESTURE;
stage.addEventListener(TransformGestureEvent.GESTURE_ZOOM, fl_ZoomHandler_2);
function fl_ZoomHandler_2(event:TransformGestureEvent):void
{
movieClip_1.scaleX *= event.scaleX;
movieClip_1.scaleY *= event.scaleY;
}
stop();
