Hi there, please help me!
I am working on a publication to store CDs and related musical segments. I get the song titles from an Acces DB and display them on a textobject while looping troughout the CD key. As a result the textobject has multiple rows, one for each title. Ad the end of the title I add a word "listen" and i create an hypertext on it. The action I have inserted is "Playsound" in order to make people listen the song they like to. Unfortunately when the pub runs all the hyperlinks start working together instead of waiting for the left mouse click. Besides it seems that i cannot stop them in any way....but quitting the pub.
Please let me know where i am making mistakes!
The code is as follows:
//Code to display songs on textobject
// cerca is the input varable to search for the CD
//Cod_brano is the single song ID
//titbran is the variable where the title is stored
var newStyle = new Object()
newStyle.bold = true
Textbox.SetSelectionStyle(newStyle)
text=corrente.toString() + ". " + titbran + " (Listen) "+ "\n"
lung=lung + text.length
Textbox.ReplaceSelection(text)
numbra[corrente]=lung
codbra[corrente]=cerca+Cod_brano
//Code to get the position of hyperlinks
//for every row i found the word "listen" and i create the hypertext whose action is the Suona(k) function.
text=""
for (k=1;k<numrec+1;k++)
{
Textbox.SetSelection(numbra[k],numbra[k]-12)
Textbox.CreateHypertext(Suona(k))
//Function description
//This function should play the song if the variable "suono" is off, otherwise it should stop it.
function Suona(k)
{
var asong=PlaySound("D:\\dischi\\brani\\"+codbra[k]+".mp3")
if (suono == "on") {
asong.Stop(true)
suono = "off"
} else {
PlaySound("D:\\dischi\\brani\\"+codbra[k]+".mp3")
asong.Stop(false)
suono = "on"
}
}
|