Page 1 of 1
Blinking Ticks!
Posted: Sat Jul 25, 2009 2:28 pm
by Damlimey
Hi all,
I have a button that I would like to flash between two colors as the player it controls reaches the last 5 seconds of the file being played.
I'm sure I can do this with the 'blinkrate' but the dictionary isn't completely clear how to use the command...
Any clues out there?
Best
D
Posted: Sat Jul 25, 2009 3:05 pm
by Klaus
You did look up "blinkrate" in the docs, didn't you?
Docs?!!!
Posted: Sun Jul 26, 2009 9:51 am
by Damlimey
Hi Klaus,
I started writing code for the first time in my 50 years on this earth when I bought Runtime just over a month ago. I've had to start from a very real blank canvass.
I've tried very hard not to raise queries on this forum unless I can't find the answer within the material I have to hand. Things that may be clear and straight forward to the more experienced programme developers aren't always so obvious to the beginner.
On this occasion I have searched the dictionary where there is an entry that I don't quite understand, the user guide where a search showed no mention of the word "blinkrate", I searched the resource centre, the tutorials that I have and the web sites, I even did a search on Google and nowhere have I found any more enlightening information about "blinkrates".
So the answer to your rather glib response to my question is this...
What Docs?
Ithankyou
D
Posted: Sun Jul 26, 2009 10:11 am
by BvG
when a long time user of rev says "docs" he always means the dictionary. it used to be the only documentation place, and "docs" kinda stuck for us old timer. It's also the one single place where you'll find every single term toroughly documented, so whenever you see a rev-term that doesn't tell you much, a visit to the dictionary is in order.
so go to the help menu and choose dictionary, or klick the dictionary button of the icon bar (the last one at the right end) . then enter "blinkrate" (no quotes) in the search/filter field, and read the entry on it. also make sure to check out the see also links, often you'll find similar terms or even alternatives that might fit what you want to do better.
Posted: Sun Jul 26, 2009 10:42 am
by SparkOut
"The Docs" usually refers to the Rev Dictionary, available in the Rev IDE by picking the icon in the toolbar at the far right.
"blinkRate" is something I never looked at before, and I would have been rather surprised if it had done what you need - and as I suspected, looking at the Docs info it seems that it just adjusts the rate of the flashing insertion point cursor.
To do this I think you would need to look up about callbacks in the player object (see here for some info
http://www.runrev.com/developers/tutori ... callbacks/ ) where you can set a trigger at 5 seconds from the end of the player to send a message to the button,say
Code: Select all
send "colourBlinker 5000" to button "btnBlinker"
(5000 being the length of time in milliseconds that the button should blink).
Then in the button script you would have a handler for the message
Code: Select all
on colourBlinker pCount
if pCount > 0 then
put the cCycle of me into tCycle
switch tCycle
case false
set the backgroundColor of me to the cForegroundColour of me
set the foregroundColor of me to the cBackgroundColour of me
break
default
set the backgroundColor of me to the cBackgroundColour of me
set the foregroundColor of me to the cForegroundColour of me
end switch
set the cCycle of me to not the cCycle of me
subtract 500 from pCount
send "colourBlinker pCount" to me in 500 milliseconds
else
set the backgroundColor of me to the cBackgroundColour of me
set the foregroundColor of me to the cForegroundColour of me
end if
end colourBlinker
If you set a custom Property in the button for the foreground and background colours then it will use those values to swap them. There are plenty of other ways Rev lets you use to skin the cat, but this was the first that struck me without thinking too hard.
HTH
Posted: Sun Jul 26, 2009 11:35 am
by Klaus
Ah, yes, sorry, of course I meant the Rev "dictionary", my fault!
But I learned a new word "glib"

Mnay thanks!
Posted: Mon Jul 27, 2009 8:59 am
by Damlimey
Hi guys,
Okay, thanks very much for that; BvG, I'll get the hang of the terminology as I go along but thank you for clarifying that.
Sparkout; Thanks for that, I'll be building that into my programme today!
Klaus; you've taught me much in a short time, so I'm happy I can teach you something like a new word! If you want to know what it means, there's always the dictionary!
Ithankyou
D