Sound in Actionscript3

The movie below will let you apply what you have learned.

  1. Download the movie.
  2. Add one of the volume controls.
  3. Play the sound through the channel.
  4. Add buttons to pause, restart and continue.
  5. Add frames to the movie so that there are frames according to this formula: numFrames=fps*sound.length/1000;
  6. Trace channel.position when you click the stage while the song is playing.
  7. Use this information to add a picture of an animal to the appropriate place in the movie.
  8. Add a slider so that the user can move to any frame in the movie.
Get Adobe Flash player
Download movie
var sound:Music=new Music();
var channel:SoundChannel=new SoundChannel();;
btnMute.addEventListener(MouseEvent.CLICK, goMute);
stage.addEventListener(MouseEvent.CLICK, goClick);
sldSong.addEventListener(Event.CHANGE, goPosition);
var sTransform:SoundTransform = new SoundTransform(0);

function goPosition(e:Event): void {

function goClick(e:MouseEvent):void {

function goMute(event:MouseEvent):void
	sTransform.volume = 0;
	SoundMixer.soundTransform = sTransform;

NEXT: Class Variables in ActionScript3