Code of a button:
Code: Select all
on mouseUp
answer folder "folder with movies" --and only movies!
if it <> "" and the result = "" then --chosen folder path is in the var "it"
set the defaultfolder to it
put the files into temp
filter temp without ".*" --to get rid of hidden files
set the moviefiles of player 1 to temp --the moviefiles is a custom property
set the filename of player 1 to line 1 of temp
start player 1
end if
end mouseUp
Code of player 1:
Code: Select all
on playstopped
put the filename of me into lastMovie
set the filename of me to ""
put lineoffset(lastMovie, the moviefiles of me)+1 into nextLineNumber
if nextLineNumber <= the number of lines of the moviefiles of me then
set the filename of me to line nextLineNumber of the moviefiles of me
start me
else --end of list, stop playback
set the paused of me to true
end if
end playstopped
This code works perfectly for me, please look terms up in the docu if you don't know what they do. I used some advanced concepts like the defaultfolder and a custom property, they simplify the code, but are harder to grasp on first encounter, so don't give up easily.
Custom Properties:
they work similar to global variables, but are attached to objects, and thus get saved together with the rest of the stack, also you don't need to declare them.
The defaultFolder:
This works similar to the working directory in a terminal/consol. Rev will look for filenames in the defaultfolder, so if you just specify a filename but no path, that file needs to be within the defaultfolder (most of the time, there are exceptions).
The Files:
a list of all files within the defaultfolder (see also "the folders")
PlayStopped message:
Gets sent when a player stops by itself, or by the "play stop" command.
lineoffset function:
lineoffset let's you find a specific line in a list, i add one to get the next movie to play.