4 Replies Latest reply on Nov 11, 2014 3:51 PM by nokonoko56

    Gestures not working

    TimT Level 1

      I'm using the following script to enable the swipe gestures on iOS...

       

      Movie Script

       

      on startMovie

        _touches.registerGesture([#swipeRightGesture:#handleSwipeRight])

        _touches.registerGesture([#swipeLeftGesture:#handleSwipeLeft])

      end

       

      Frame Script

       

      on handleSwipeRight

        go next

      end

       

       

      However this dosen't work - ie nothing happens when I swipe the screen (on either the iphone iOS7 or ipad iOS6. Is this how the code should be implemented?

        • 1. Re: Gestures not working
          Sean_Wilson Adobe Community Professional

          Is it possible the frameScript isn't "active" when the gesture is made? That is, that the playhead isn't on the frame in question. Try placing your #handleSwipeRight and #handleSwipeLeft handlers in a movie script

          1 person found this helpful
          • 2. Re: Gestures not working
            TimT Level 1

            The playhead is on the frame correct frame when the gesture is made. It's the first frame of the movie.

             

            I added the hanndles to the movie script...

             

            on startMovie

              _touches.registerGesture([#swipeRightGesture:#handleSwipeRight])

              _touches.registerGesture([#swipeLeftGesture:#handleSwipeLeft])

            end

             

            on handleSwipeRight

            go previous

            end

             

            on handleSwipeRight

            go next

            end

             

            And in the frame script...

             

            on exitFrame me

              go to the frame

              handleSwipeRight

              handleSwipeLeft

            end

             

            This sort of worked - but the it flashed back and forwards between frames without the screen being touched.

             

            I changed the frame script to the folowing and it worked...

             

            on exitFrame me

              go to the frame

            end

             

            on handleSwipeRight

              go previous

            end

             

            on handleSwipeLeft

              go next

            end

            • 3. Re: Gestures not working
              TimT Level 1

              I've got the left and right gestures working okay, but becuase the handler is in the movie script and not the frame script I'm having problems changing the destination of the gesture. It's okay if the swipes are alway going to the previous or next marker. But it gets more complex if I want to start having the playhead going to different frames.

               

              I ended up creating a global varaible to determine which frame is the next destination. The variable is set in the frame script.

               

              Movie Script

              on startMovie

                _touches.registerGesture([#swipeRightGesture:#handleSwipeRight])

                _touches.registerGesture([#swipeLeftGesture:#handleSwipeLeft])

                global gwhatframeLeft

                global gwhatframeRight

                set gwhatframeLeft = "2"

                set gwhatframeRight = "60" --last frame

              end

               

              on handleSwipeLeft

                global gwhatframeLeft

                go to frame gwhatframeLeft

              end

               

              on handleSwipeRight

                global gwhatframeRight

                go to frame gwhatframeRight

              end

               

               

              Frame Script (Frame "2")

              on exitFrame me

                go to the frame

                global gwhatFrameLeft

                set gwhatFrameLeft = "3"

                global gwhatFrameRight

                set gwhatFrameRight = "1" --first frame

              end

               

              This seems like an awkward way to do this (It will make testing a lot more time consuming) - is there a more stright forward way.

              • 4. Re: Gestures not working
                nokonoko56 Level 1

                First, Director (12) is started and the following script is described.

                 

                Movie script

                 

                on startMovie

                   _touches.registerGesture ([#swipeRightGesture:#handleSwipeRight])

                   --It recognizes also by "on prepareMovi" or "on startMovie".

                end

                on handleSwipeRight

                   member("momo").text = the long time & "start"

                   --code to handle Right Swipe

                end

                 

                "on startMovie" is recommended although recognized also by "on prepareMovie" or "on startMovie". Those with a possibility of stopping moving by "on prepareMovie" when another Handler is put in.

                And use a movie script by a property inspector. This is important. Unless it comes out, the Handler written in here does not move.

                If it moves by Director in order to move by ios, an error will come out.It is published and used for ios.

                detailed my Homepage(Candy's Homepage)