Create a simple shape and convert


Create a simple shape and convert it to a movie clip. Name it actions.

The load handler attached to this movie clip starts the sound playing. It sets the pan to -100 so that the sound comes only from one side.

The enterFrame handler looks at the position and duration properties of the sound object. These are both measured in milliseconds. By dividing these by each other and multiplying by 200, you get a value from 0 to 200. Subtract 100 to get a value from -100 to 100. Then, set the pan to this value:

The result is that the sound starts on one side, coming completely out of one speaker. Then the sound travels to the other side as setPan is used to set the pan to values between -100 and 100. The sound should end with a pan of 100.

Try the movie 22airplane.fla to see this in action.

Taken From: Sams Teach Yourself Flashâ„¢ MX ActionScript in 24 Hours

  1. No comments yet.
(will not be published)
  1. No trackbacks yet.
  • Partner links