• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Lesson 13. Markers and Navigation > Simplifying Scripts Using Relative Markers

Simplifying Scripts Using Relative Markers

In the next task, you'll use relative markers in another way.

Select the behavior channel, frame 30, and delete the script by pressing Delete. Also delete the scripts in frames 45, 60, 75, and 90of the behavior channel.

The scripts in these frames were go to frame "MarkerName" scripts. You placed these scripts here to keep the playback head on these frames so users could make another selection on the screen. You still need to keep the playback head from moving past all the frames of the destination screens, but you're going to refer to a relative marker instead.

The go to frame "MarkerName" script would still work, of course, but with relative markers, you can write just one script and have it work effectively in many sections.

Double-click the behavior channel, frame 31, to open the Script window. Type go marker(0) below on exitFrame and then close the window.

Figure .

This script returns the playback head to frame 30, which is the closest frame to the left that contains a marker.


It is best to leave the frame script in frame 27 of the behavior channel because looping the playback head to frame 15 would trigger the transition in frame 15 of the transition channel. That would make the transition play over and over again, annoying users. The go frame script keeps the playback headin one place so users can make a selection from the main menu.

Copy frame 31 in the behavior channel and then paste the script into frames 46, 61, 76, and 91 in the behavior channel.

Figure .

Now when you click the menu options on the main screen, the playback head will branch to the frames you assigned to these options through the Behavior Inspector and then move to the next frame (just as before). As the playback head begins to exit the frame after the marker, it will encounter the command go marker(0). At this time, marker(0) (the marker the playback head has passed most recently) is the marker in the previous frame, so the playback head goes back to the previous frame. When it moves to the next frame, Director instructs it to go to marker(0) again. Thus, the playback head will loop between the frame where the marker occurs and the following frame continuously until the user makes another selection.

Remember that marker(0) is relative to the position of the playback head. Relative markers always refer to a marker based on the current position of the playback head, not to a marker in a specific frame.

Rewind and play the movie. Click the privations and excesses menu option.

Everything still works as it did before, but now the script refers to a relative marker instead of a marker name. Look at the playback head and notice that it is looping between frames 30 and 31.

Click the dotbottom navigation control to return to the main menu. Click another menu option to display one of the destination screens you've built.

The playback loops between the frame that contains the script and the frame that precedes it. You'll frequently use this technique in your own Director development. As you've seen in this task, you have to write the script only once and then just copy and paste, and it will work!

Stop the movie and save your work.



Not a subscriber?

Start A Free Trial

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint