Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+37 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 (1 point)

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 (1 point)
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.

...