ScriptTimer Question

Multimedia Builder (Legacy Forum)
Post Reply
Sk8cynic
Posts: 29
Joined: Thu Oct 04, 2012 12:51 pm

ScriptTimer Question

Post by Sk8cynic »

Hi,

I created a script timer that incrementally lowers the volume (fades out) of the music on a page when a button (FadeBtn) is pressed.
The script I have is:

VolumeDown()
ScriptTimer("FadeBtn","500")
VolumeDown()
ScriptTimer("FadeBtn","500")
VolumeDown()
ScriptTimer("FadeBtn","500")
VolumeDown()
ScriptTimer("FadeBtn","500")

The script runs fine but when the volume is returned to its initial setting (100), the timer runs automatically and lowers the volume as long as it is on the same page.

According the Help File, the only way to kill a scriptimer is to leave the page and then return or go to another page. That is true and the timer works if another page is chosen. I want to be able to kill the script each time it is run on the same page. I tried using things like PageTimer with a zero value to reset the page but that doesn't seem to work.

Anybody run into this and is there a way to kill/stop the scripttimer if it's still on the same page?

Thanks for any help!

dgilmour
Posts: 541
Joined: Fri Oct 22, 2010 11:29 am
Location: Moskva, Rusko
Contact:

Re: ScriptTimer Question

Post by dgilmour »

Code: Select all

vol = CBK_Volume
If (vol) Then
  VolumeDown()
  ScriptTimer("FadeBtn","500")
End
A text object with the "CBK_Volume" label must exist on the page.

Sk8cynic
Posts: 29
Joined: Thu Oct 04, 2012 12:51 pm

Re: ScriptTimer Question

Post by Sk8cynic »

dgilmour,

Thank you for your quick reply! It worked perfectly! I forgot to ask...how do I stop the sound at the end of the timing period? (my bad)

Thank you again for your help!

dgilmour
Posts: 541
Joined: Fri Oct 22, 2010 11:29 am
Location: Moskva, Rusko
Contact:

Re: ScriptTimer Question

Post by dgilmour »

If you mean stopping playback after fade out then this modified code should do the job:

Code: Select all

vol = CBK_Volume
If (vol) Then
  VolumeDown()
  ScriptTimer("FadeBtn","500")
Else
  StopSound()
End

Sk8cynic
Posts: 29
Joined: Thu Oct 04, 2012 12:51 pm

Re: ScriptTimer Question

Post by Sk8cynic »

dgilmour,

LOVE IT! Perfect!

Again, thank you so much!!

Post Reply