Another newbie question...

MFitz53 at cs.com MFitz53 at cs.com
Sun Aug 25 20:51:00 CDT 2002


I really dislike cluttering up this list with this beginner question, but 
have had no success with figuring out why I cannot make this work. I have 
tried moving scripts and changing the orders of the handlers and have not 
gotten rid of this particular problem.
 My intent is to be able to load a playist(field) of music titles and play 
them in the order they are listed. This part will work fine. The problem 
arises when I use the button to stop the current playlist and load a 
different playlist. After I stop the current playlist, I must repeat the 
process of loading another playlist twice. I do not know or have been able to 
see why.
Qusetion: Can this problem be attributed to having the process split up 
between handlers as a workaround for the 10 line script limitation? I am 
about to buy the SB license, but this has me a little worried.
 So here it is folks, my whole playlist team of scripts (and some of yours as 
well!).


BTN "Load Playlist"script: Step One
on mouseUp
  global mySpot,folderPath
  put 1 into mySpot
  put the cAudioFolderPath of this stack into folderPath
end mouseUp


Field "playlistnames" script: Step Two The list where the names of the 
playlists (and the fields by the same name) are kept
on mouseUp
  global titles
  put the value of the selectedLine into titles
send mouseUp to button"playit"
end mouseUp



BTN "playit"script: Step Three

on mouseUp
  global titles
  global mySpot
  add 1 to mySpot
  put item mySpot of fld titles into audioToPlay
  put the cAudioFolderPath of this stack into folderPath
  set the filename of player"audioPlayer" to folderPath&"/"&audioToPlay
  set the currentTime of player"audioPlayer" to 0
  put audioToPlay into fld"currentplay"
  start player "audioPlayer"
end mouseUp -- All works well until I want to stop the current playlist and 
load a new one. The following


BTN "Stop Music"script: This is part of the problem. When I use this, then 
attempt to load another playlist, I must use "Load Playlist" again and select 
again before it will play. When I check the message box for the condition of 
my global variables, "mySpot" (which should be 1 when I load a new playlist) 
always contains a number too high to be used unti I repeat the process a 
second time.

on mouseUp
  global titles,mySpot,folderpath
  delete global mySpot -- I was using put empty  with the same results
  delete global titles
  stop player"audioPlayer"
  set the currentTime of player"audioPlayer" to 0
  put empty into field"currentplay"
end mouseUp



Player audioPlayer script:
on playStopped
  send mouseUp to button"playit"
end playStopped

Thanks
mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.runrev.com/pipermail/use-livecode/attachments/20020825/a4689b8d/attachment.html>


More information about the use-livecode mailing list