The movie
The main part, which is different from using mp3 files is that we cannot import the wav file using ActionScript. Instead we import the wav file to the library (image 1). We click on "Export for ActionScript" and enter the path to a class file, which we need to create, if we have not yet done.
The "Beat" class is a very simple basic class, which extends the Sound class.
package biz.Flashscript
{
import flash.media.Sound;
public class Beat extends Sound
{
public function Beat()
{
}
}
}
Another class, which we need is to draw the columns for the analyzer. This is a simple drawing class, which uses the Shape and Graphics classes. We don't need to further discuss the class except that we have several parameters for colors and sizes.
package biz.Flashscript
{
import flash.display.DisplayObject;
import flash.display.Graphics;
import flash.display.Shape;
import flash.display.Sprite;
public class RectBar extends Sprite
{
public function RectBar(bgColor:uint, borderSize:uint, borderColor:uint, myWidth:uint, myHeight:uint)
{
var child:Shape = new Shape();
child.graphics.beginFill(bgColor);
child.graphics.lineStyle(borderSize, borderColor);
child.graphics.drawRect(0, 0, myWidth, myHeight);
child.graphics.endFill();
this.addChild(child);
}
}
}