Drag mouse release to trigger next scene


(Jonathan) #1

Hi everyone,

I have a slider element that I’d like for when the user releases their mouse once they’ve dragged the slider to the specific value, for it to jump to the next scene.

And furthermore, is there anyway for the selected value on the slider to be populated into the next scene as a “result”?

Thank you!

Slider selecting $9,000

Resolve frame / scene with result you’ve selected

Hype File:
JVD Slider.hype.zip (44.0 KB)


Addition of values from sliders
How to make text count up/down with scrolling bar
(Hans-Gerd Claßen) #2

you can use custom behaviours to avoid scripting.
please have a look a the very good documentation (hype pro only …)


(Jonathan) #3

I’m a bit lost here…

how do you create a behavior? How does it work? I can’t possibly just type “On click release take it to scene 2” and it work!

Thanks!


(Hans-Gerd Claßen) #4

To create a new behavior: At the bottom of either the Scene or Action inspector, click Add New Behavior.Give the new behavior a unique name.Add any number of actions. Invoke the new behavior using the Trigger Custom Behavior action.

… copied and pastedv from the documentation :slight_smile:


(Hans-Gerd Claßen) #6

Custom behaviors allow you to create your own action handlers that can
be triggered like Hype’s built-in action handlers. Just like Hype’s
built-in action handlers, your own behaviors can trigger a series of
actions. Behaviors ensure you don’t repeat any work when creating and
using complex actions. For example, you might want to simultaneously
start three timelines when a scene loads and then later start those same
three timelines when the user clicks a button. Before behaviors you
would have to set up those three Start Timeline actions both in an On
Scene Load and an On Mouse Click action handler. Now, with behaviors,
you can create one new behavior that invokes Start Timeline and have the
On Scene Load and On Mouse Click action handlers run that behavior.
Furthermore, if you decide to change which timelines are run, only need
to make changes once for the behavior.

… copied from the documentation :slight_smile:


(Jonathan) #7

Hans,

I’ve read that several times. It still isn’t helping me. I don’t understand how it works. How do I set the dot on the slider to queue next scene when user has clicked off of it?

I have this set, but it does not work:


(Hans-Gerd Claßen) #8

Jonathan,

i don’t know how you made your slider. there are a few few possibilities out there to built a slider :slight_smile: but i guess the aim of the slider is not to click on it … dragging would be an option ;_)

can you provide a hypefile¿


#9

Basically, on your “dot” object you want to run an action “On Mouse Up” that triggers your custom behaviour.

So click on your “dot” and then go to the inspector pane->Actions and then click the plus next to “On Mouse Up (touch end)” and choose “trigger custom behaviour” and choose your behaviour that you created from the list.

On testing when you have done this you will find that every time you let go of the “dot” it will jump to the “300x250 Resolve” scene.

Now, you want to transfer the “amount” as well. For this you will have to run a couple of javascript functions that will record the amount as you drag and then take the last amount when you let go of the “dot” and transfer it to the new scene.

WARNING: Advanced technique

Because you haven’t shared the document I don’t know how you’re updating the amount. The following is my view on updating the amount. At least this is how I would do it. This also eliminates the use of trigger custom behaviour as I am using the API to send to the next scene.

First create a function on the same action by clicking the plus next to “On Drag” on what I am assuming is the “dot” element. You should already have some actions there in reference to the drag but underneath a new action will appear. Choose “Run Javascript” and type the following code…

Better still. Here is a document: sliderAmount.zip (23.6 KB)

This will show you the technique.

P.S this is stepping on @h_classen’s toes as he would be able to do this in his sleep but the reason he has posted what he has posted is that we are trying to make this forum a learning environment not a “I have a problem … what’s the solution” A lot of what and why we know how to manipulate Hype to do our bidding is that we have spent time learning the documentation and what Hype can offer. Also a bit of programming knowledge too :slight_smile: granted not many users may be happy to learn the code or even know where to start but an effort has to be made. That being said is why I jumped in. I could see the effort that you did the custom behaviour and thought there could be a better approach as you wanted the “amount” to carry over and that would have involved Javascript anyway. There a a few ways to get to the solution I’m sure and this is just one of them.

Wow, that was longer than I thought. Anyways. Enjoy and see if you can put the pieces together for your own use. A tip is to share your document from the beginning so that we can see what you are trying to do.


How to make text count up/down with scrolling bar
(Hans-Gerd Claßen) #10

good cop bad cop :innocent:

:+1:


(Jonathan) #11

JVD Slider.hype.zip (44.0 KB)


#12

JVD Slider-vDBear.hype.zip (38.1 KB)


(Hans-Gerd Claßen) #13

clever solution, good old hype :slight_smile: