Salve a tutti, sto facendo un ActionScript, per riprodurre i file audio, per ora ho aggiunto 2 bottoni, il playPause (se lo si clicca va in pausa e se lo si riclicca fa in play) e il bottone next, per cambiare canzone.... il broblema sorge quando testo il filmato, il rollover del tasto next non funziona e non so come fare a risolvere il problema.
Qui di seguito trovate l'ActionScript, mentre qui trovate il filmato di prova...
// Setup dello script
var s:Sound = new Sound();
s.onSoundComplete = playSong;
s.setVolume(75);
// Array delle canzoni
var sa:Array = new Array();
// Canzone in riproduzione
var cps:Number = -1;
// Posizione della musica
var pos:Number;
// Load delle canzoni dal file 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[i].attributes.url);
}
playSong();
}
xml.load("songs.xml");
// Play dei file MP3
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")
}
// Musica in pausa
function pauseIt():Void
{
pos = s.position;
s.stop();
}
function unPauseIt():Void
{
s.start(pos/1000);
}
// Controlli della musica
// Play/Pause della musica
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();
}
}
// Bottone Next
next.onRollOver = function()
{
next.gotoAndStop("nextOver");
}
next.onRollOut = next.onReleaseOutside = function()
{
next.gotoAndStop("next");
}
next.onRelease = function()
{
this._parent.playSong();
}
PS ditemi se provando lo script sentite la musica. Grazie