AS para mp3 Player em flash
:blink: Olá comunidade! Estou voltando ao Flash e AS mas já começo
apanhando, rsrsrs... Tô com um code de um mp3 em flash, porém
ele está escrito para a música iniciar ao carregar a página e eu queria
que só iniciasse quando clicasse num botão. Abaixo segue todo o código:
CODE
// Setup sound objectvar s:Sound = new Sound();
s.onSoundComplete = playSound;
s.setVolume(100);
// Array of songs
var sa:Array = new Array();
// Currently playing song
var cps:Number = -1;
// Position of music
var pos:Number;
// Load the songs XML
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = function()
{
var nodes:Array = this.firstChild.childNodes;
for(var i=0;i<nodes.length;i++)
{
sa.push(nodes*.attributes.url);*
}
playSong();
}
xml.load("songs.xml");
// Play the MP3 File
function playSong():Void
{
s = new Sound();
if(cps == sa.length - 1)
{
cps = 0;
s.loadSound(sa[cps], true);
}
else
{
s.loadSound(sa[++cps], true);
}
playPause.gotoAndStop("pause");
}
// Pauses the music
function pauseIt():Void
{
pos = s.position;
s.stop();
}
// Pauses the music
function unPauseIt():Void
{
s.start(pos/1000);
}
// Music Controls
// Play/Pause Toggle
playPause.onRollOver = function()
{
if(this._currentframe == 1) this.gotoAndStop("pauseOver");
else this.gotoAndStop("playOver");
}
playPause.onRollOut = playPause.onReleaseOutside = function()
{
if(this._currentframe == 10) this.gotoAndStop("pause");
else this.gotoAndStop("play");
}
playPause.onRelease = function()
{
if(this._currentframe == 10)
{
this.gotoAndStop("playOver");
this._parent.pauseIt();
}
else
{
this.gotoAndStop("pauseOver");
this._parent.unPauseIt();
}
}
Quem puder ajudar, estou no MSN.
leebano@hotmail.com
Grato.
Discussão (2)
Carregando comentários...