Hey guys-
This is the first AS3 I’ve touched since it came out. I am messing around with the computeSpectrum and now im kind of stuck…
I have it working, but I want to add more to it. For example…I want it to be a gradient…kind of like this one:
I have a little example that ive done here and even added a little blur filter, but other than that I dont know what else i can do…
http://ostari.com/ronnie/spectrum/spectrum.swf
var mySound:Sound = new Sound();
mySound.load(new URLRequest("song.mp3"));
mySound.play();
var myByteArray:ByteArray = new ByteArray();
function readSpectrum(event:Event) {
SoundMixer.computeSpectrum(myByteArray, false,0);
graphics.clear();
for (var i = 0; i<256; i+= 8) {
drawSpectrum(myByteArray.readFloat(),i);
}
}
function drawSpectrum(myReadFloat:Number, myIteration:Number) {
var myNumber:Number = myReadFloat * 500;
graphics.lineStyle(1, 0x000000);
graphics.beginFill(0x99ff00);
ball.rotation = myNumber*-0.1;
graphics.drawRoundRect((16 * (myIteration / 8)) + 19,250,16,-(myNumber/2),20,20);
//graphics.drawRect((16 * (myIteration / 8)) + 19, 250,16,-(myNumber / 5));
//graphics.drawEllipse((16 * (myIteration / 8)) + 19,250,16,-(myNumber / 5));
//graphics.drawCircle((16 * (myIteration / 8)) + 19,250,-(myNumber / 5));
var filter:BitmapFilter = new BlurFilter(3,3,BitmapFilterQuality.HIGH);
//var filter:GlowFilter = new GlowFilter(0x00ccff,5,2,2,50);
var myFilters:Array = new Array();
myFilters.push(filter);
filters = myFilters;
}
this.addEventListener(Event.ENTER_FRAME, readSpectrum);
and there is my code…soo any tips on making the bars a gradient like the first example I showed?