Hello Rafa,
welcome to the forum.
this is a link to an article in the RunRev Newsletter. It explains callbacks.
http://www.runrev.com/newsletter/july/i ... tter3.html
and I attach a stack by Klaus Major, which he posted on the old RevOnline, not easily accessible with Rev 3.5 and beyond.
I hope Klaus does not mind.
It is a very nice example stack to demonstrate callbacks.
Basically what it amounts to is that you can set a property of a player with a list of callbacks. One callback per line.
For the timing of the callbacks you will want to know how to when the callback is made.
For this you have to realize that a movie/audio in a player has a time scale. That time scale slices the seconds into individual intervals.
As an example: You have a movie of 5 seconds. The movie has a timescale of 600. So every second has 600 "time slices" and since the movie is 5 seconds long you get 3000 "slices". This is the duration of a movie. (by the way 600 is often used in movies, but not always). If you want a callback after 1 second you say
600,showbutton
after 2 seconds
1200, showButton
When the movie/audio is playing and reaches these time slices, which by the way is the currentTime of a player, it fires off the callback to the player object.
You have to provide a handler to take care of the "showButton" part of the callback.
I made a simple player with a movie of a duration of 720. The timescale is 600.
to find out the above I made a button
Code: Select all
on mouseUp
put the duration of player 1 && the timescale of player 1
end mouseUp
which puts the duration and the timescale into the message box.
In another button I placed this:
Code: Select all
on mouseUp
put "300,showButton 1" & return & "600,showButton 2" into aList
set the callbacks of player 1 to aList
end mouseUp
You will notice that I put "showButton 1" as the callback. This way the callback showButton will also send a parameter,in this case 1. I use this to address the buttons later.
in the script of the player I put this script:
Code: Select all
on showButton whichButton
put "b" & whichButton into tButtonName
set the visible of button tButtonName to not the visible of button tButtonName
end showButton
and I made 2 buttons which I named b1 and b2. If you dont want to show the silly name "b1" of a button you can set its label to something more meaningful.
This will toggle the visibility of the buttons after half a second for btn b1 and one second for button b2.
I hope this explains it a bit.
regards
Bernd
If you still have questions dont hesitate to ask.
regards
Bernd