Showcase and discover digital art at yex

Follow Design Stacks

Subscribe to our free newsletter to get all our latest tutorials and articles delivered directly to your inbox!

Scripting the dialog in Macromedia Flash MX

Scripting the dialog in Macromedia Flash MX

The script that plays back the text and the beeping in the dialog box consists of two parts.

At the top of each scene is a Script layer. Select the first frame in the Script layer and you will see several variables defined in the Action window.

  • The line variable is a string object that defines the text the speaker will say (or beep).
  • The speaker variable defines the speaker (Jane or Shadow).
  • The following “beep” variables identify the sound files that will play depending on the speaker variable. Jane’s beep sound is pitched higher than Shadow’s.

We created a movie clip that plays the text in each scene. The movie clip script:

  • Writes the speaker variable (the speaker’s name) to the dialog box.
  • Writes the speaker’s text variable up to the value of the current frame number.
  • Plays the appropriate “beep” sound for each character in the speaker’s text, unless there is a “space”.

Of course, we also built the other interface elements, including the buttons to advance to the next scene and turn the sound on and off.

Take a look at the scripting we developed. Experiment by changing the speaker’s text. If you change the length of the speaker’s text, you might have to change the length of the scene, which is the same length in frames as the number of characters in the speaker’s text.

When you are ready, export the whole scene as Macromedia Flash 6 and watch the scene playback.

Comments