Adding Code to Setup the Application Once it is Launched
At this point your Video Player application is working in the Revolution IDE and you are just about ready to build an application that you can share with others. The final step is to write a little revTalk that will populate the video menu and load the first video when your application is launched.
With the Video Player Stack window as the frontmost window choose Object > Card Script.
When a Stack window is about to be opened up and displayed on the computer Revolution sends the preOpenCard message to the Card that is about to be shown. This is a good place to initialize the menu and load a video.
To initialize the menu all we need to do is call uiPopulateVideoList (1) as that reads in the list of video files and populates the menu.
After the menu has been populated we can load the first video in the list. Before we load the video we check to make sure that at least one video exists in the menu. Checking that the text of field "Video Menu" is not empty (2) accomplishes this. If the text property of the field contains any text at all then there is at least one video file.
After confirming that there is at least one video we use revTalk to change the line that is selected by setting the hilitedLIne property of the list field to 1 (3). This selects the first line of the list field.
With the first line selected we finally call uiLoadSelectedVideo which loads the currently selected video in the menu (4).
Copy & Paste Into Card Script
## Load the video list
## If there is at least 1 video in the list then load the video
if the text of field "Video Menu" is not empty then
set the hilitedline of field "Video Menu" to 1