Return to Kroll Web Design home page Flash tutorials

« Return

ActionScript 2

Sound: alternating streaming sound with bullet points that fade in


This technique can be used to deliver presentations where narration is sync'd with bullet points that fade in. Note that there was no need to place sound files and tweens on the timeline. Rather, it was all accomplished with Action Script.

Download the FLA file

bullet1_mc._alpha = 0;
bullet2_mc._alpha = 0;
bullet3_mc._alpha = 0;
bullet4_mc._alpha = 0;
bullet5_mc._alpha = 0;
bullet6_mc._alpha = 0;

var mySound1:Sound = new Sound();
var mySound2:Sound = new Sound();
var mySound3:Sound = new Sound();
var mySound4:Sound = new Sound();
var mySound5:Sound = new Sound();

mySound1.attachSound("sound1");
mySound2.attachSound("sound2");
mySound3.attachSound("sound3");
mySound4.attachSound("sound4");
mySound5.attachSound("sound5");

mySound1.setVolume(20);	
mySound1.start();
var currClip:MovieClip = bullet1_mc;

onEnterFrame = function()
{	
  if(currClip._alpha >= 100)
	{
    delete currClip.onEnterFrame;
  }
	else
	{
    currClip._alpha += 5;
  }
}

mySound1.onSoundComplete = function()
{
mySound2.setVolume(70);	
mySound2.start();
currClip = bullet2_mc;
}

mySound2.onSoundComplete = function()
{
mySound3.setVolume(100);	
mySound3.start();	
currClip = bullet3_mc;
}

mySound3.onSoundComplete = function()
{
mySound4.setVolume(100);		
mySound4.start();	
currClip = bullet4_mc;
}

mySound4.onSoundComplete = function()
{
mySound5.setVolume(80);		
mySound5.start();	
currClip = bullet5_mc;
}

mySound5.onSoundComplete = function()
{
currClip = bullet6_mc;
}