|
|||
| week 11a - director navigation code, exercise | |||
navigation : score frames as scenes : |
It is common to use the frames of the score to make different scenes made up of sprites together on the stage together--this is similar to the way we've used frames in the Flash timeline. For example, an informational application could use one frame for the title page, and other frames for the interface to each set of content. Below is the score from such a Director project, a gallery of projects from the Media Design Program. The channels in frame one, labeled "start," have several text sprites for the title page, frame 6 ("page1") have sprites for the content of the first gallery, and frame 12 ("page2") have sprites for the second gallery.
|
|
| loop on frame : | keep the play head on one frame Normally, Director would play from the first frame of the movie through to the last frame that has content, and then loop back to the beginning. To prevent this, you must put some code in the script channel (above the numbered frames). In Flash, you would put a simple "stop();" in the frame. In Director, you use an event handler just as you would on a sprite. To put code in the script channel:
The following code will prevent the play head from advancing beyond the current frame:
|
|
| markers : | navigate to different frames by name As with Flash, it's possible to label frames with "markers" and use them in the code. Frame markers are better than using frame numbers, because they enable you to move the content of the scene and the marker without affecting the code. To create markers:
Code on a sprite to move to a specific marker would look like this:
|
|
| change member : | change information within a scene To make rollovers and change the content of a scene you often use the member property of a sprite. The member property points to a particular entry in the cast, and can be changed. The following code changes the member of the current sprite and other sprites to different cast members. Note that the sprites are referred to by name. Set this name by selecting the sprite, and then in the property inspector choose the Sprite tab and type in the name. The name on the right side of the equals sign are the names of the cast members. Set cast member names by clicking on the cast member, and typing in the name in the name box at the top of the cast window.
|
|
| exercise : |
write the code for a gallery application gallery.dir (10.2 meg with code version, no code version, includes quicktime movie and other assets) As a class exercise, reproduce the behavior of the above director movie. We'll view the working version first, and then you will work with the version that has all the assets but no code.
|
| all materials on this web site © copyright 2004, Philip van Allen |
top |