Page 1 of 1

Create Flash Playlist with pgLoadFlashMovie()

PostPosted: Mon Mar 03, 2014 3:35 pm
by Clifton
Procedure:
  1. Put the urls for each file in the playlist into an array variable that we'll name myMovies.
    • Draw a field on the page and type your movie urls each separated by a carriage return.
      Image 1.png
      Create list of movie urls in a field
      Image 1.png (2.95 KiB) Viewed 4684 times
    • Create the array by using pgSplitToArray() and specify myMovies as the return variable.
      Image 2.png
      Copy playlist into array variable
      Image 2.png (12.82 KiB) Viewed 4684 times
  2. On load page, we loop through myMovies to find the first valid url (in this case it will always be the first one. Once a valid url is located ( with the Action Editor expression not ( not myMovies [ n ] ) which will equal true when the value is anything but empty or the integer 0), then we load that url with pgLoadFlashMovie() and then immediate empty that index of the array so that this movie cannot be played again (unless we reload the playlist).
    Image 3.png
    Loop through array to find valid url and load with pgLoadFlashMovie()
    Image 3.png (17.4 KiB) Viewed 4684 times
    Now the movie begins to play (notice that notifyObject = true so we receive a user event when the movie ends).
     
  3. Finally, we code the on user event to check when the movie has ended. If it has, then we again loop through myMovies to find the next valid url to play. When a valid url is found we call pgUnloadFlashMovie() to clear the container field and then load the next url using pgLoadFlashMovie() exactly as we had done previously for the on load page event.
    Image 4.png
    User event code
    Image 4.png (9.42 KiB) Viewed 4684 times
  4. When all movies in myMovies have been played, the for each loop will fail to find a valid url at any index and exit the user event by placing our prompt text in a field to alert the user that the play list has finished.
Download example:
SWF_Player_tb90.zip
ToolBook v90 example of above
(27.13 KiB) Downloaded 399 times
SWF files (or use your own and adjust the example file accordingly):
http://www.pgsoftwaretools.com/powerpac/assessments/swf.zip