package
{
import com.increpare.bfxr.Bfxr;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.ui.Mouse;
import ui.TinyButton;
[SWF("220", height="120", backgroundColor="#C0B090")]
public class Bfxr_API_Example extends Sprite
{
private const soundData:String = ",0.5,,0.3484,,0.2472,0.3,0.4135,,0.2198,,,,,,,,,,,0.015,,,,,0.4293,,,0.0539,,,,masterVolume";
private var sound1:Bfxr;
private var sound2:Bfxr;
private var sound3:Bfxr;
public function Bfxr_API_Example()
{
InitSounds();
var b:TinyButton;
b = new TinyButton(Button1Click,"Runtime Synthesize");
b.x = 10; b.y = 10;
this.addChild(b);
b = new TinyButton(Button2Click,"Play Precached");
b.x = 10; b.y = 40;
this.addChild(b);
b = new TinyButton(Button3Click,"Cached Mutation");
b.x = 10; b.y = 70;
this.addChild(b);
}
private function InitSounds():void
{
sound1 = new Bfxr();
sound1.Load(soundData);
sound2 = new Bfxr();
sound2.Load(soundData);
sound2.Cache();
sound3 = new Bfxr();
sound3.Load(soundData);
sound3.CacheMutations(0.05,10); }
private function Button1Click(caller:TinyButton):void
{
sound1.Play();
}
private function Button2Click(caller:TinyButton):void
{
sound2.Play();
}
private function Button3Click(caller:TinyButton):void
{
sound3.Play();
}
}
}