3 Replies Latest reply on Oct 28, 2017 12:22 PM by darfnekds

    AIR for Android: Swipe gesture causes other touch events to not work

    derek.atkinson

      I'm new to Flash and Actionscript, so please bear with me and forgive any huge mistakes. I'd very much appreciate any help I can get.

       

      I am building a graphic design portfolio application to carry with me on an Android tablet, and hit a snag. I'm building the application using Flash CS6, and I have not used Actionscript before. So far I've been making everything using the code snippets panel and a couple outside resources. I'm assuming my problem is due to the Actionscript not being written correctly, since I've assembled it all essentially by copy/pasting code and editing it.

       

      The application is set up with buttons for navigation at the top of the screen, as well as redundant buttons for the same navigation below (essentially jumping to what looks like a lower card in a stack of cards). Testing as I build it, I've found that this navigation works perfectly navigating from every frame to every other frame. The place where I hit a snag is when I add a swipe gesture on a movie clip on one frame. When I navigate to this frame now, the rest of my navigation ceases to work (immediately when the frame loads).

       

      The code for the problem frame is as follows. The top few items are for navigation; the swipe gesture is at the bottom.

       

      Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
      
      print_bigbutton.addEventListener(TouchEvent.TOUCH_TAP, fl_TapHandler_10);
      
      function fl_TapHandler_10(event:TouchEvent):void
      {
          gotoAndStop(20);
      }
      
      
      
      Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
      
      web_bigbutton.addEventListener(TouchEvent.TOUCH_TAP, fl_TapHandler_11);
      
      function fl_TapHandler_11(event:TouchEvent):void
      {
          gotoAndStop(25);
      }
      
      
      
      Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
      
      ill_bigbutton.addEventListener(TouchEvent.TOUCH_TAP, fl_TapHandler_12);
      
      function fl_TapHandler_12(event:TouchEvent):void
      {
          gotoAndStop(30);
      }
      
      
      /*Keeps button below from being clicked*/
      
      Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
      
      branding_newbar.addEventListener(TouchEvent.TOUCH_TAP, fl_TapHandler_13);
      
      function fl_TapHandler_13(event:TouchEvent):void
      {
          stop();
      }
      
      //Swipe
      Multitouch.inputMode = MultitouchInputMode.GESTURE;
      
      var currentTile:Number = 1;
      var totalTiles:Number = 6      ;
      
      slides_branding.addEventListener(TransformGestureEvent.GESTURE_SWIPE , onSwipe); 
      
      function moveLeft():void{
          slides_branding.x += 800;
      }
      
      function moveRight():void{
          slides_branding.x -= 800;
      }
      
      function onSwipe (e:TransformGestureEvent):void{
          if (e.offsetX == 1) { 
              if(currentTile > 1){ 
                  moveLeft()
                  currentTile--
              } else {}
          }
      
          if (e.offsetX == -1) { 
              if(currentTile < totalTiles){
                  moveRight()
                  currentTile++
              }
          }
      }
      
      stop();
      

       

       

       

      I'm also new to Flash, so I may be doing a whole mess of things incorrectly. I've been using code that does what I want it to, but possibly not using it correctly. For example, for my navigation buttons at top I needed to place the code only on the first frame and it worked on every other frame. Yet, in order for the redundant buttons (on lower "cards" in the stack) to work on different frames, I had to add a touch event for navigation on separate frames (which is the other code you see here at the top).

       

      If it would be helpful to provide the .fla file, I can upload it.

      In case it helps to understand the mess I've made, this is what my stage and timeline look like:

      Screen Shot 2013-06-04 at 11.24.01 AM.png

       

      If anyone is willing to take the time to help me figure out what I've done wrong, I'd really appreciate it. Otherwise, I'll look into finding a simpler way to navigate through the portfolio slides.

      Thank you!

       

      --

      Working in Flash CS6

      Actionscript 3.0

      Problem occurs both in Air Debug Launcher (Mobile) and on device (Asus Nexus 7)