please help with "on playStopped"

J. Landman Gay jacque at hyperactivesw.com
Tue Aug 2 10:45:34 EDT 2005


Ban Nguyen wrote:
> Hello everyone,
> 
> 
> I have a list of songs (scrolling list field "list"):
> 
> I put this script so when user select a song, then start the player
> 
> on selectionchanged
>   set the fileName of player "myPlayer" to the selectedtext of field
> "list"
>   start player "myPlayer"
> end selectionchanged
> 
> 
> I put this script into the player object "myPlayer" because I want the
> next songs continue to play:
> 
> on PlayStopped
>   local thisLine
>   put the hilitedLines of field "list" into thisLine    --current line
>   set the hilitedLines of field "list" to (thisLine+1)  --next line
>   set the fileName of player "myPlayer" to the selectedtext of field
> "list"
>   start player "myPlayer"
> end PlayStopped
> 
> 
> 
> For some reason, it does not work right.  What it does is playing the
> first song.  After the first song done, it selects the second song (no
> playing), then selects the third song and plays. I open the property of
> player object and see in the source shows "the second song"
> 
> 
> Could someone please help?  The code looks right to me but I don't know
> if I am missing anything.


Try putting a "lock messages" before you set the hilitedline in 
PlayStopped. I think setting the hilitedline is also causing a 
"selectionchanged" message to be sent, so the script changes the 
selection twice.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the use-livecode mailing list