Skip to main content
Known Participant
August 17, 2015
Answered

In FLASH CC can I have a swf file use swipe instead of clicks?

  • August 17, 2015
  • 2 replies
  • 672 views

I have created a FLASH CC a swf that acts like an application. With buttons clicking to go to other screens. I want to be able to swipe on some screens to other ones on a  touch screen, or touch enabled tablet. Can I do that? If so how?

Thanks,

This topic has been closed for replies.
Correct answer Paladin Jog

Yes, Of cause. You can add an event listener to stage of your application, such as:

stage.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();

  }

  }

}

Actually you can use the Template of Flash CC to do this:

  • Select File > New.

  • Click the Templates tab.

  • Select "AIR for Android" or "AIR for iOS" from the Category list, select "gesture swipe library"(last one of list) from the Category Items list, and click OK.

2 replies

Paladin Jog
Paladin JogCorrect answer
Participating Frequently
August 18, 2015

Yes, Of cause. You can add an event listener to stage of your application, such as:

stage.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();

  }

  }

}

Actually you can use the Template of Flash CC to do this:

  • Select File > New.

  • Click the Templates tab.

  • Select "AIR for Android" or "AIR for iOS" from the Category list, select "gesture swipe library"(last one of list) from the Category Items list, and click OK.

Known Participant
August 18, 2015

This is great!

I will use this. Didn't even think about the templates.

Thanks

Paladin Jog
Participating Frequently
August 19, 2015

You are Welcome. It's my pleasure.

kglad
Community Expert
Community Expert
August 17, 2015

you can code that yourself using mousedown, mousemove and mouseup events or, if you're publishing for a touch-enabled device, you can use the flash touchevents including touchmove.

Known Participant
August 18, 2015

Thanks for the information!

kglad
Community Expert
Community Expert
August 18, 2015

you're welcome.