Page 1 of 1
control player object with mouse scroll wheel
Posted: Sun Dec 02, 2007 9:39 pm
by Martin Koob
I was wondering if there was a way to make a player object receive the scroll messages from a mouse with a scroll wheel or from a two finger scroll gesture on a Mac Book Pro track pad.
The Quicktime Player application and a quicktime player in a web page does receive these so you can scrub back and forth in the video with the scroll button or on the track pad. I have tried this with a player in revolution and it does not work.
Martin
Posted: Mon Dec 03, 2007 1:47 am
by BvG
the scrollweel emits rawkeydown messages, so you can catch that, and do anything you want, like increasing or decreasing playloudness, the currentime, or the playrate.
Posted: Tue Dec 04, 2007 2:31 am
by Martin Koob
Thanks for the tip.
I managed to trap the rawkeydown messages and have them change the player's current time by putting the handlers I have listed below in the player's script, but, now when I scroll the mouse wheel up and down the slider in the movie controller moves accordingly but the movie does not redraw. If I click on a step button or push play then the movie will refresh and show the next frame. Is there another command that I need to make it redraw?
I don't have this problem in other situations where I set the currenttime of the player. It jumps to a new location and the movie display is updated. Is it because it is such a small increment?
on rawKeyDown theKeyNumber
if theKeyNumber is 65308 then stepforward -- mouse wheel down
else if theKeyNumber is 65309 then stepbackward -- mouse wheel up
else pass rawKeyDown
end rawKeyDown
on stepforward
set the currenttime of me to (the currenttime of me) + ((the timescale of me / 4))
end stepforward
on stepbackward
set the currenttime of me to (the currenttime of me) - ((the timescale of me / 4))
end stepbackward
Martin Koob
Posted: Tue Dec 04, 2007 4:05 pm
by trevordevore
Hi Martin,
Try changing your code to this:
Code: Select all
on stepforward
lock screen
set the currenttime of me to (the currenttime of me) + round(the timescale of me / 4)
unlock screen
end stepforward
on stepbackward
lock screen
set the currenttime of me to (the currenttime of me) - round(the timescale of me / 4)
unlock screen
end stepbackward
locking/unlocking the screen worked on my end. Also adding round() to the calculation is necessary for movies that don't have a timescale of 600 (mp4 and mpg for example).