help on count down timer

Jakey106

Member
Licensed User
Longtime User
Hey guys
I am in the need of some help. I have been fishing through the site looking through tutorials and examples and i have not yet come across something that will help me out with my code.
Now this is what i want to do, I have a list view with a number of items in it and these items have a audio file attached to it, so when i select the item and click play it plays the audio file.
But i also want to add a timer so the user can select the specific item than set a time for example 10seconds than the timer will count down to 0 and play the audio file of the item that was selected.

I am a bit of a noob to coding so if someone can point me to a tutorial or help me out with the code i will greatly appreciate it.
 

derez

Expert
Licensed User
Longtime User
The code should be something like this -
in the global definitions put:

dim mp as mediaplayer
dim timer1 as timer
dim counter as int

sometime at application start do:
initialize the mediaplayer
initialize the timer for 1000 ms

in item event do:
mp.load...(specific audio file)
counter = 10
timer1.enabled = true

in timer1_tick do:
counter = counter - 1
if counter <= 0 then
mp.play
timer1.enabled = false
end if
 
Upvote 0
Top