Chapter 16. Scripting for Sound


Few things enhance the way we experience something more than sound. Not only can sound provoke an almost instantaneous emotional response, it also provides dimension. When standing in the middle of a crowded room, you can close your eyes and easily determine the relative position of things just by listening. Thus, you can employ sound to provide your user with context as well as to create an engaging experience.

A thorough understanding of how to control sound dynamically is key to creating everything from games to custom MP3 players. In this lesson, we'll demonstrate Flash's versatile sound controls by emulating a bouncing basketball inside a gym.

Flash's sound controls will let this basketball sound like the real thing when we're done with it.

graphics/16fig01.gif

The user can drag the ball within a predefined area of the screen, and as the ball is dragged, the volume and panning of the bounce will be controlled dynamically to indicate its current location. In addition, you'll see how Flash enables you to add and control sounds in your movie without placing them on the timeline.

WHAT YOU WILL LEARN

In this lesson, you will:

  • Learn how to create a Sound object

  • Drag an object within a visual boundary

  • Control the volume of a Sound object

  • Control the panning of a Sound object

  • Add sounds to your movie using the attachSound () method

  • Start, stop, and loop sounds dynamically

APPROXIMATE TIME

This lesson takes approximately 1½ hours to complete.

LESSON FILES

Media Files:

None

Starting File:

Lesson16/Assets/basketball1.fla

Completed Project:

basketball6.fla



Macromedia Flash MX ActionScripting Advanced. Training from the Source
Macromedia Flash MX ActionScripting: Advanced Training from the Source
ISBN: 0201770229
EAN: 2147483647
Year: 2002
Pages: 161

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net