Exercise 3
X
More Director
Step by step instructions
1) Create a new folder on your desktop. Title the folder 390 EX3. Go to the Classwork Server > 390 Notes and download the Graphics EX3 folder to the folder you just created on your desktop.

2) Launch the Director 7 application and immediately save the blank project as EX3.dir in the 390 EX3 folder.

External Casts

3) Choose Modify>Movie>Casts Type External.cst in the Name field and click External. Make sure Use in Current Movie is selected and then click Create.

The new external cast you created will be saved as a separate file called External.cst. (Windows uses the .cst file name extension to identify the file as a Director cast. Even if you are working on a Macintosh, it is a good idea to use this file name extension, since it makes your project easier to work with on a Windows system later.) By selecting External, you're telling Director to save the cast as a separate file instead of storing it in the movie file. The Use in Current Movie option links the new cast to the current movie. If this option is not selected, Director still creates the cast as a separate file, but the cast is not available from within the current movie.


Using Lingo To play Sounds.

1.Open a new movie.
2.Turn the looping on in the control panel.
3.Open the tool palette.
4.Click the push button icon.
5.Draw a button on the stage, and type in button (a very original name).
6.Click the button in the cast window and choose cast member script.
7.Director writes the first and last line for us, add a beep command so the script look like this:
on mouseUp
beep
end
8.Close the window.
9.Rewind and play the movie.
10.Click the button a few times.

SoundEdit 16

1. Open the SoundEdit 16 program.

2. Select the Wave item in the View menu (this is also the default view).

3. Select Faster Approximation from the Wave & Style pop-up menu (this is also the default setting).

4. Select the default Ruler Units item in the View menu.
•Set the Time to Frames.
•Set the Amplitude to Decimal.
•Set the Frequency to kHz.
•Click OK.

Grabbing Sound from a CD

1. Insert the Sound effects CD into the CD player.

In the SoundEdit 16 menubar, click the CD-ROM icon

The dialog box should automatically go to the CD if it does not navigate to the desktop and open your CD,A list of numbered tracks should appear.

2. Select Track 17 and click the Open button. Another dialog box appears, offering an Options button. Click the Options button.

The Audio CD Import Options dialog box appears. To save memory select 22.050 kHz, 8 bit, and Mono at the top.

3. Save to your 390 EX3 folder on the desktop
(A small window will show the sound being converted to SoundEdit 16, / AIFF file.)

The newly converted sound appears in a SoundEdit 16 track, ready to be worked on inside the main SoundEdit 16 program.
You can also select just a part of a track to record:

•Move the Start and End slider points to where you want them, or select/type them.
•Click Play to hear your selection.
•Click OK when you have reached the end of the selection.

4. Repeat this proceedure with track 20 and 45. Then give the CD to another student to download.

Editing by Cutting and Pasting

1. Select the first two spikes in the sound track with the mouse. Copy this into the clipboard Edit > Copy..

2. Open up a new file: File > New. Click the cursor at a point in the sound track where you want the copy to be placed.
3. Select Paste from the Edit menu.
4. Check your sound by clicking the Play button.
5. Because we cut the sound before it ended it stops abruptly. We are going to fade the end of the sound out by selecting the last few second of the sound and selecting the Fade out button.
6. In the dialog box select Slow and click the Fade button.
7. Select the entire sound and check it by clicking the Play button.
8. Save the file as 390EX3sound.
9. Open up Track 20. Select the second spike, copy and paste it into 390EX3sound. Repeat this with track 45. Fade each of these clips in and out.
10. The bowing sound is a litle wimpy. Select the spikes that represent the bowling sound. Select Effects > Amplify. 200%.

Setting Cue Points

1. Place your curser at the end of the bell sound. Create a cue point Insert > Cue point. Label the cue point "Bells." Do the same for the end of the Bowling pins sound. Label the cue point "Bowling". Finally insert a cue point at the end of the wild animal sound and label it "Wild".

2. Save the file as Audio IFF. See: File Formats in SoundEdit 16

Additional Notes
Deleting Parts of a Sound
  1. Select the part of the sound you want to delete.
  2. Press the Delete key.
  3. Check the resulting sound by clicking the Play button.

Cropping Parts of a Sound

  1. Select the part of the sound you want to keep.
  2. Choose Crop from the Edit menu.
  3. Check the resulting sound by clicking the Play button. (Note that sounds resulting from cropping usually need to be moved forwards or backwards in the track.)
    Adding and Playing More Sound Tracks
  4. Select Add Track from the Sound menu.
  5. Record or paste a new sound in the new track.
  6. Repeat the above to add more tracks, if you like.
    (You can also arrange sounds in relation to other sounds by selecting a track and sliding it back and forth by holding down the Option key, then clicking and dragging.)
  7. To select for playing:
    All tracks together, choose Select All from the Edit menu.
    One or more separate tracks:
    -Click on the starting point of the highest track you want to play
    -Hold down the Shift key and click on the end point of the lowest track you want to play
    -Use the Command key to skip a track and select non-consecutive tracks
  8. Click the Play button on the Controls palette.
  9. To delete a track, select the track and choose Delete Track from the Sound menu.

Using Effects to Change How a Sound Plays

  1. To change a sound by using Effects:
    Select a sound to add an Effect to.
    For example, choose Backwards from the Effects menu.
    In the dialog box, use the defaults and click OK.
  2. Click the Play button in the upper left part of the sound's track window.
    (You play an individual track by using a track's Play button, or all selected tracks by using the Controls palette Play button.)
  3. If you don't like the result, choose Undo immediately from the Edit menu.
  4. Experiment with other Effects. (Note: Different sounds react to effects in the different ways-i.e., the change is not always obvious.)

Making a Sound File's Size Smaller:

  1. With previously recorded sound, select Sound Format from the Modify menu.
  2. Choose 11.025 kHz (CD) -or whatever smaller size is available-from the pop-up menu.
    (Read the sound size information at the bottom of the dialog window.)
  3. Click OK.
    (An alert box may pop up and tell you that you cannot record at this smaller size, but you don't want to record. Click OK to change the sound settings anyway. Remember to come back here to reset the sound to a recordable level if you want to record again.)
  4. Be sure to check the resulting sound by playing it.
  5. And, be sure to use UNDO immediately; it does not remember more than the last event recorded.
  6. Your file size can also be cut in half by using only one track (mono instead of dual mono or stereo).
  7. Save your new version when you are satisfied with the result.

Sound, Lingo and Cue Points (Navigating using Lingo)

There may be times when you need to use Lingo to synchronizesound or digital video with events in the score. For example, you may want to synchronize a digital video with an animation that you have created using Lingo. In this case, the Lingo that is doing the animation also needs to be able to monitor the cue points, because the tempo channel can control events only in the score, not events generated by Lingo. Or you may have a digital video playing with a separate sound file for narration, and each may have its own set of cue points. The Tempo dialog box lets you set only one cue point per frame, and therefore you w ill need to monitor both sets of cue points simultaneously with Lingo. Finally, one of the more common questions heard by Director Technical Support concerns rollover buttons not responding when the movie is using the tempo channel to wait for a cue point. For that reason, Macromedia recommends always using Lingo to check cue points.

1. Open the director file EX3.dir. Open the External Cast widow. Select cast member 1, Choose File > Import and select 390EX3sound file and then click the Import button.

As the digital video plays, Director keeps track of cue points as they occur in the sound file. You will use the the mostRecentCuePoint property to ask Director for the number of the last cue point it encountered. The numbers returned by this property correspond to the order of the cue points within the digital video.

The syntax for this property is sprite(WhichChannel).mostRecentCuePoint. You replace Which Channel with the channel that the digital video occupies in the score.

2. Double-click the behavior channel, frame 10, to open the Script window. As you learned in Lesson 16, you need a frame script to control the playback head. Director has started the most common type of frame script—an exitFrame handler.

3. Complete the exittrame handler as shown here:

on exitFrame me
if sprite(1).mostRecentCuePoint = 0 then
go to the frame
end if
end

Until the first cue point in the Quick Time digital video passes, the the mostRecentCuePoint property returns 0. So long as the the mostRecentCuePoint value is 0, the if-then statement keeps the playback head looping in the current frame. Only after the first cue point passes and the the mostRecentGuePoint property returns I will the if-then statement be bypassed, so the playback head can travel past frame 10.

4] Close the Script window, save your work, and play the movie. Now you are controlling the synchroniz.ation through Lingo!


Creating invisible buttons

Creating Invisible buttons
1. Click on frame 1 of channel 2.
2. Open the Tool palette window.
3. Click on the no line button.
4. Click on the rectangle button and draw a rectangle the size of stage.
5. Double click on this sprite, choose script from the menu and then type the command:

on mouseUp
play movie "secondpart.dir"
end

6. Insert a pause script at frame 30, save the movie and then play the movie and click anywhere on the stage. The play command works in a similar way to the go to command. One difference is that Director remembers every time the play command is initiated, keeping track of the users' path through the movie. We will use this tracking to create a back button, by using the play done command.

7. Open the secondpart.dir file. Click on the 'back' button sprite on the stage. In the top left corner of your score click on New Behavior button.

8. When the script window appears type in the command:

on mouse up
play done.
end

9. To make this image behave more like a button, click on the sprite/cast and then choose Modify>Cast Member>Properties, then click on the Highlight when Clicked option.

10. Save the movie, open EX3.dir and click on the frame. You will notice that the back button now links the movie back to the original location, and its also highlights when clicked. The play and play done commands are not limited to one level. Try expand the presentation down further branches and experiment with the commands. Experiment with Behaviours - choose Window>Library Palette then click on the icon in the top left hand corner and choose Animation>Interactive. A list of behaviors will appear, just click ones you like and drag them straight onto sprites, play the movie and observe.

11. When you move from one movie to another the sound continues to play. To prevent this we have to tell the sound sprite to stop playing. Go to the invisible button sprite and open up the script. We are going to change the script to:

on mousedown
sound stop 1
end
on mouseup
play movie "secondpart.dir"
end

This will stop the sound when the mouse is depressed and will start the second movie when the mouse is released.

This is all we are going to cover during the class lecture. If you are interested in beginning to learn about lists you may read further.

Lists
Lists are a kind of variable that contain multiple pieces of data at once. Each unit (known as an entry) can be manipulated without affecting the others. Lists are vital for a strong command of Lingo’s advanced functions. Well-written lists help manage multiple windows, Xtras, Parent/Child objects and any other data you have in your movies.

There are 2 types of lists:
Linear list: is a series of single values in sequence. Each item, separated by a comma, is a single unit of data, which can be a variable or text string.

Property list: contains 2 units of data for each entry, separated by a colon (:) One unit is the value (data to be stored, retrieved or modified), while the other serves as a property (another value used primarily for organising purposes).

Lists have to be assigned to a variable to be used.

set ListName to [entry1, entry2, etc]

The square brackets are crucial, since they tell Lingo how to recognise a list. To dispose of a list (or create a list prior to entries), set the values to 0 by using empty brackets set ListName to [ ]. For a property list, use a colon set ListName to [:].

1. In the message window type: set FruitList to ["Bananas", "Grapes", "Strawberries"]

You have created a linear list called CourseList with 3 entries, each a text string. Text is always placed in inverted commas "", otherwise Lingo will read the entries as variables. Note variable have to be single words, you cannot have spaces in a variable name. 

2. In the message window type:
put FruitList

This should return the list we’ve just created. If you read any <void> entries, you may have left out the inverted commas and Director is reading the entry as a variable, which has no value. Try creating the list in step one with just variables.

The power of lists lies in the many ways you can access and modify the information they contain. Lingo has several commands and functions serving this purpose below are few.

getAt (list, postion)
This function returns the value on the list at the position indicated.
3. In the message window type:
put getAt (FruitList, 2)

You should see
-- "Grapes"

4. In the message window type:
put getOne (FruitList, "Strawberries")

This time the result should be 3, since it is the third item on the list.

addAt (list, position, value)
This function adds an entry at a specified position of a linear list.

4. In the message window type:
addAt (FruitList, 2, "Kiwi")
put FruitList

The new name should appear in the list at position 2, pushing the other items one back. 

Experiment with the following

setAt (list, position, value): adds an entry at a specified slot, overwriting the contents of that location.
add(list, value): will simply add another entry. If the list is unsorted, the addition will be at the end, if sorted, it will go into its proper location in the alphanumeric order.
append(list, value): adds the specified value at the end of the list even if it is sorted.
getLast (list): returns the last value on a list
count(list): returns the number of items on a list
sort(list): sorts a list in ascending order

Property Lists
Sometimes data has significant significance only in context, that’s when we use property lists.

For example: Let’s look at students each with a grade for their interfolio assignment.

1. In the message window type:
set IFList to ["John":95, "Duncan":50, "Emily":65, "Sarah":75] 

Each name has a numerical value associated with it. This is the property, and in this case represents the percentage score.

getProp(list, value)
2. Enter the following:
set result to getProp (IFList, "John")
put result

3. Enter the following:
put min (IFList)

The result is 50.

4. Enter the following:
put getOne (IFList, 95)

The message window should return "John".

Other property list functions and commands
findPos(list, property)
setProp(list, property, value)
deleteProp(list, property)
sort(list): note how this command differs when using it in a property list.

Symbols
One trick that comes in handy when using lists is the use of symbols rather than text strings to identify values. By placing a pound sign (#) before a data name,(#dean) you define it as symbol. Symbols are not variables as their value cannot change. The advantage is they take up less memory, are retrieved faster and are generally very efficient.