playMaker

Author Topic: Drag UI button in Scroll Rect[SOLVED]  (Read 5066 times)

joel.carlson

  • Junior Playmaker
  • **
  • Posts: 66
    • Salvation's Story
Drag UI button in Scroll Rect[SOLVED]
« on: January 10, 2017, 06:53:43 PM »
So I'm implementing a 'More Games' section. It contains a scroll rect with a number of my other games. The user can click each banner and the game will popup.

Unfortunately, as soon as the user touches the image to drag, the link is activated. Is there a way around this? I've tried On Pointer Up and On Pointer Down. Not really sure how do do it.
« Last Edit: January 12, 2017, 01:08:03 AM by jeanfabre »
Check out Noah's Elephant in the Room, Bible ABCs for Kids, Bible Coloring for Kids, and Noah's Bunny Problem at
Salvations Story

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Drag UI button in Scroll Rect
« Reply #1 on: January 11, 2017, 04:25:35 AM »
Hi,

 yep :) it's a common problem indeed...

two ways to go about this:

1: don't use the Button UP event, but instead compose the pointerUP and PointerDown event and keep track of a bool "isDown", then if the scroll changes, reset the "idDown" so that on PointerUp you don't do anything.

2: disabled scrolling when you press a button that is within this scroll.

Let me know how it goes.

 Bye,

 Jean

joel.carlson

  • Junior Playmaker
  • **
  • Posts: 66
    • Salvation's Story
Re: Drag UI button in Scroll Rect
« Reply #2 on: January 11, 2017, 01:08:56 PM »
Thanks for the quick response! I'll try it out today.
Check out Noah's Elephant in the Room, Bible ABCs for Kids, Bible Coloring for Kids, and Noah's Bunny Problem at
Salvations Story

joel.carlson

  • Junior Playmaker
  • **
  • Posts: 66
    • Salvation's Story
Re: Drag UI button in Scroll Rect
« Reply #3 on: January 11, 2017, 07:02:03 PM »
Ha! Well, I was just writing out all the steps I'd taken in creating the new FSM, and how it still wasn't working. I was writing out state 2/5 and that's when I noticed my mistake.

Thanks! All working now!

For those curious, here's how I set it up.

*edit- and now I realized the ios/android states should go back to state 1
« Last Edit: January 11, 2017, 07:04:35 PM by joel.carlson »
Check out Noah's Elephant in the Room, Bible ABCs for Kids, Bible Coloring for Kids, and Noah's Bunny Problem at
Salvations Story