TUTORIAL 7 Adding Interactivity

Embed Size (px)

Citation preview

  • 7/30/2019 TUTORIAL 7 Adding Interactivity

    1/2

    TUTORIAL 7: ADDING INTERACTIVITY

    In the first scripting tutorial, you wrote simple commands within a script, telling Director

    to beep and open an alert window. Often you will use scripting to add navigation to your

    presentation. This gives users control over the flow of the presentation, allowing them toexplore movies at their own pace, pause or repeat parts of the movie or exit the

    presentation.

    Creating Loops

    This is the process of continuously returning the playback head to the same location it

    has come from, until the user gives instructions to exit the loop.

    Double click frame 5 of the scripting channel and type the following script:

    on exitFrame**go to frame 1

    end

    Make sure the looping option in the control panel is turned off, play the movie and

    watch what happens in the score.

    Pausing a movie

    To pause a movie, simply create a script that loops the playback head in the current

    frame. The script is as follows:

    on exitFrame

    **go to the frame

    end

    The go to command sends the playback head to a specific point in your movie. In the

    above script,the frame represents the current frame.

    Moving between sequences creating markers

    Director allows you to markcertain frames in your movie so they can be identified by

    buttons and links.

    1. Open a new movie.

    2. We are going to identify 3 points in the movie by placing various shapes on thestage. Using the Vector Shape tool, create a square, circle, and some other shapeyou like.

    3. Place the square in the score so it extends from frame 10-19, the circle over

    frames 20-29 and the 'other' over frames 30-39.

  • 7/30/2019 TUTORIAL 7 Adding Interactivity

    2/2

    4. As in tutorial 11, create 2 push buttons cast members. Place the casts in thescore and make sure they are extended over frame 1 to frame 39. Label one pushbutton nextand the otherprevious.

    5. Place a pause script in frame 10, 20 and 30.

    6. Click in the marker channel in frame 10, as soon as you click a markeriscreated with text naming it as New Marker. Type in squareover this text.

    7. Create markers at frame 20 and 30, naming them circle and other(or anothername to identify your other shape) respectively. You can delete a marker by clickingthe triangle and dragging it below the marker channel.

    8. Create a sprite behavior (script) for the nextpush-button you created, which

    reads:

    on mouseUp**go to nextendThe go to nextstatement tells Director to go to the next consecutive marker in thescore.

    9. Create a sprite behavior for theprevious button which reads:on mouseUp

    **go to previousend

    The go to previous statement tells Director to go to the previous marker in thescore.

    10. Play the movie, click on the buttons and see how they work.

    In the above set of steps you created movement over consecutive markers. With

    Director you can make a button jump to as a specific point. To do this, do as follows:

    1. Create another set of push buttons giving them the same names as your shapes.

    2. For each button, create a cast member script which uses the statement:go to "markerName"

    For example the button for the square will have the following script:on mouseUp**go to "square"end

    3. Play the movie and click on the new set of buttons you created.