Articles Archive
Articles Search
Director Wiki
 

Playing a Sequence of Director Movies

October 25, 2001
by Will Turnage

Hello Handyman,

I have a Director movie with several branches. There is a main menu with buttons that link to the various branches. When the playhead reaches the end of a branch it automatically takes the user back to the main menu. What I also want is a Play All button on the main menu that would play all the branches successively. Thanks for any help/advice you can give me,

Doug

 

Dear Doug,

If you want to play a sequence of movies in a row, what you need to do is create a variable that's a list of all the movie names you want to play in a row. This list will then be used by all of your different branches so they will know where to go next. The key thing to remember is to make the list of movies a global variable. That way, even though you are going from one Director movie to another, the global variable remains in memory and can be read by any movie.

To do this in your project, the first behavior you will need to create will go on each of the buttons in your main menu. Say for instance, that your main menu looked like this.

In this instance, here's what that button behavior will look like.

property pMovie


on getPropertyDescriptionList

  props = [:]
  props.addProp(#pMovie, [#format:#symbol, #default:#movie1, #comment:"Select Destination movie:", #range:[#movie1,#movie2,#movie3,#movie4,#movie5,#all]])
  return props

end

global gPlayList

on mouseUp me

  case pMovie of
    #movie1: gPlayList = ["movie1"]
    #movie2: gPlayList = ["movie2"]
    #movie3: gPlayList = ["movie3"]
    #movie4: gPlayList = ["movie4"]
    #movie5: gPlayList = ["movie5"]
    #all: gPlayList = ["movie1", "movie2", "movie3", "movie4", "movie5"]
  end case
  go movie gPlayList[1]

end

When you attach this behavior to each button, a dialog box pops up that allows you to pick which button this behavior is being attached to: movie1, movie2, movie3, etc. The second part of the behavior is executed when the user clicks on the button. First it checks the pMovie property to see what button you've assigned it to, and then it creates a global variable containing a list of all the movies you want to play. Once the list has been created, then your movie jumps to the first movie in the play list.

When you've done that, you will need to make a second frame script that goes in the final frame of each and every movie that is a branch off your main menu. The code in that behavior looks like this:

global gPlayList

on exitFrame me

  gPlayList.deleteAt(1)
  if gPlayList = [] then
    go movie "main"
  else
    go movie gPlayList[1]
  end if

end

When you reach this frame in your movie, the first thing it does is delete the first element of the play list you originally created. Then it checks to see if the play list is empty. If it is empty, then it sends you back to the main menu movie. Otherwise, it sends you along to the next movie in the play list.

The same technique can be used with a single movie and frame labels, by replacing the movie names in the mouseUp handler of the button behavior with the names of the labels, changing go movie to just go in the exitFrame handler of the frame behavior, and using the frame behavior at the end of each branch section instead of at the end of branching movies.

A sample set of Director 8 movies is available for download in Windows or Macintosh format.

Will Turnage is a multimedia programmer based in New York City. In addition to his weekly role as Director Online's Multimedia Handyman, he is also the Technology Director for Sony Music's Client Side Technologies Group. You can read more about his work at http://will.turnage.com/.

Copyright 1997-2017, Director Online. Article content copyright by respective authors.