Welcome to the CSC Q&A.
Get help and give help!
Write great code!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+35 votes

In our project we have a forward and backward button. While the buttons work on moving the video, how can i got about interacting the slider with these buttons.

asked in CSC285_Fall2018 by (8 points)

1 Answer

+21 votes
 
Best answer

You can use the setValue method for the Slider object to set the frame number for your slider in a similar way that you would on the video. Simply get the current frame and add however many frames you need to skip forward or back.

answered by (2.1k points)
selected by
+12

The reason this method works is that you already added a listener to the slider that says "whenever the slider's value changes, update the frame being shown". Calling slider.setValue(...) will change the value (just as if the user had dragged the slider with the mouse), and will trigger the same event.

+5

Thank you, this helped a lot.

...