Tutorial 6

Reusing code -- a Video Controller in Lingo

In this tutorial you will see how to use code from another movie to create a video controller in your movie of choice. When reusing code it is necessary to examine it carefully to make surre any hard coded items are replaced with more general references. For instance if any reference is make to assigning a castmenber number and then the casmember is moved from that locations, you will break the script. Hardcoding scripts will almost insure that you will have to make major changes in order to reuse them. By using variables to replace actual numbers you go a long way to make repurposing possible.


1. First open the movie vidcontroller7.dir. and snag the example movie as well. Remember to right click on the links on a PC or just click and save as source on the Mac as we demonstrated in class. Keep them in the same folder as the .dir references the ldriver.mov file.


 2. open the .dir file in Director.You will see this scene.  


   3. Select the video controller graphics and the quicktime movie sprites. Copy them and then open your target movie that you want to copy the controller into. Paste them in the frame where you want the movie to run. All this goes in one frame.


4. Make sure to add a go to the fram e script in the frame where the movie plays.


5. Note: when you transfer info from one movie to another, ONLY THE CASTMEMBERS REPRESENTED BY SPRITES ON THE SCORE accompany the transfer. In the case of rollover or mousedown states of buttons, as here, you must go back and copy the alternate states that are brought in on the castnum switching part of the rollover! Otherwise your buttons will disappear when clicked. In the image below, number 1-7 are switched out with 11-17 on mousedown.

6. Open up the script for the controller. It operates by attaching it to the sprites themselves in the frame- select the appropriate buttons if they are not already attached and then select the script as a behavior. Note the highlight of the movie mname in the second line of the actual script : "ldriver.mov". You will need to rename this for the movie name of the substituted movie you wish to control.


7. Play the movie.

back to TOC