A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: swipe and touch together

  1. #1
    Junior Member
    Join Date
    Oct 2013
    Posts
    13

    swipe and touch together

    Hello I hope you can help me ...

    I want to do a little app with a swipe function and a touch / tap function on the same frame

    On the first frame Ive got a start button to touch and an arrowbutton to swipe to the side

    from cartoon smart.com I bought the mobile AS3 basics package

    In these tutorials they show you how you do the touch gesture and how you can do the swipe gesture...sepratly....and it works wonderfully

    but the script which I have put together does not work together ... sepratly it does. What could be the problem why it does not work together?

    How can I fix this problem?....Is there a tutorial where they show how I can use swipe function with touch/tap function on one frame?

    this is my code maybe there is just a little mistake...Sorry for my english Im from Germany

    Code:
    stop();
    
    
    import flash.events.TouchEvent;
    import flash.ui.Multitouch;
    import flash.ui.MultitouchInputMode;
    import flash.events.Event;
    import flash.events.TransformGestureEvent;
    import flash.events.GestureEvent;
    import flash.filters.BlurFilter;
    
    Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
    
    startbtn.addEventListener(TouchEvent.TOUCH_TAP , tapHandlerbb);
    
    function tapHandlerbb(e:TouchEvent):void
    {
         gotoAndStop(2);
    }
    
    
    
    var blur:BlurFilter = new BlurFilter();
    
    zombie.cacheAsBitmap = true;
    bg.cacheAsBitmap = true;
    
    Multitouch.inputMode = MultitouchInputMode.GESTURE;
    
    stage.addEventListener(TransformGestureEvent.GESTURE_SWIPE, onSwipe);
    
    function  onSwipe (e:TransformGestureEvent) :void {
         
         if (e.offsetX == 1) {
            
            zombie.x += 100;
         }
         else if (e.offsetX == -1) {
            
            zombie.x -= 100;
         }
         else if (e.offsetY == -1) {
            
            zombie.y -= 100;
         }
         else if (e.offsetY == 1) {
            
            zombie.y += 100;
         }
         
         
         
    }

  2. #2
    Junior Member
    Join Date
    Oct 2013
    Posts
    13
    Hi this is my New code

    now the problem is when I first tap the tapping work but the swipe does not
    but when I first swipe the swipe function works but the tapping doesent?

    where is the mistake?....any help or tips?

    Code:
    stop();
    import flash.events.TouchEvent;
    import flash.ui.Multitouch;
    import flash.ui.MultitouchInputMode;
    import flash.events.Event;
    import flash.events.TransformGestureEvent;
    import flash.events.GestureEvent;
    import flash.filters.BlurFilter;
    
    
    
    
    
    Multitouch.inputMode = MultitouchInputMode.GESTURE;
    
    startbtn.addEventListener(PressAndTapGestureEvent.GESTURE_PRESS_AND_TAP, tapHandlerbb);
    
    stage.addEventListener(TransformGestureEvent.GESTURE_SWIPE, onSwipe);
    
    function tapHandlerbb(tapEvent:PressAndTapGestureEvent):void
    {
    gotoAndStop(2);
    	
    }
    
    function onSwipe(swipeEvent:TransformGestureEvent):void
    {
    
    
    	zombie.x +=  300 * swipeEvent.offsetX;
    	//zombie.y +=  400 * e.offsetY;
    
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center