playMaker

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

joel.carlson

  • Junior Playmaker
  • **
  • Posts: 54
    • View Profile
    • Salvation's Story
Drag UI button in Scroll Rect[SOLVED]
« on: January 10, 2017, 04: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 11, 2017, 11:08:03 PM 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: 12342
  • Official Playmaker Support
    • View Profile
Re: Drag UI button in Scroll Rect
« Reply #1 on: January 11, 2017, 02: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: 54
    • View Profile
    • Salvation's Story
Re: Drag UI button in Scroll Rect
« Reply #2 on: January 11, 2017, 11:08:56 AM »
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: 54
    • View Profile
    • Salvation's Story
Re: Drag UI button in Scroll Rect
« Reply #3 on: January 11, 2017, 05: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, 05: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