Cod: Selectaţi tot
var _sound:Sound = null;
var _ba:ByteArray = null;
var _gfx:Sprite = null;
function Init()
{
_sound = new Sound(new URLRequest("tutorial.mp3"));
_ba = new ByteArray();
_gfx = new Sprite();
addChild(_gfx);
addEventListener(Event.ENTER_FRAME, Update, false, 0, true);
_sound.play();
}
function Update($e:Event):void
{
SoundMixer.computeSpectrum(_ba,true);
_gfx.graphics.clear();
_gfx.graphics.beginFill(0x0033CC);
for(var i:uint=0; i<80;i++)
{
var num:Number=-_ba.readFloat()*50-1;
_gfx.graphics.drawRect(i*4,50,3,num);
}
}
Init();
Scriptul e un spectrum pentru o melodie.
Am un mp3 player in As2 si am gasit acest script pe net si vreau sa il atasez mp3 player-ului , numai ca e in As3.
Va multumesc.