我正在尝试修改Storm Flash MP3播放器以记录播放/未播放歌曲的艺术家姓名和标题。如果存在IO错误,作者更新播放器以跳过歌曲。 我找到了下面的代码,它适用于播放的歌曲。出于某种原因,当我将它添加到IOError函数时,它根本不起作用。
说到Flash,我是新手。任何帮助将不胜感激。
//Record Played Song Info via PHP script
scriptVars.var1 = "1+" + String(aMP3Tracks[iCurrTrack][1] + "+" + aMP3Tracks[iCurrTrack][2]);
scriptVars.var2 = (scriptDate);
scriptRequest.method = URLRequestMethod.POST;
scriptRequest.data = scriptVars;
scriptLoader.load(scriptRequest);
//End of Record Played Song Info via PHP script
播放功能
function playMP3():void {
tMP3Transform.volume = nCurrVolume;
schMP3 = sMP3.play();
schMP3.soundTransform = tMP3Transform;
**//Record Played Song Info via PHP script
scriptVars.var1 = "1+" + String(aMP3Tracks[iCurrTrack][1] + "+" + aMP3Tracks[iCurrTrack][2]);
scriptVars.var2 = (scriptDate);
scriptRequest.method = URLRequestMethod.POST;
scriptRequest.data = scriptVars;
scriptLoader.load(scriptRequest);
//End of Record Played Song Info via PHP script**
if(mcStormHolder.mcPlayBtn.currentFrame >= 20) {
schMP3.stop();
}
schMP3.addEventListener(Event.SOUND_COMPLETE, incrementTrack, false, 0, true);
removeEventListener(Event.ENTER_FRAME, updateViz);
bForceRandom = false;
addEventListener(Event.ENTER_FRAME, updateViz, false, 0, true);
}
IOERROR功能
function onMP3IOError(e:IOErrorEvent):void {
trace("An IO error occurred while attempting to load the MP3 track.");
//sMP3.removeEventListener(Event.COMPLETE, onMP3Loaded);
sMP3.removeEventListener(IOErrorEvent.IO_ERROR, onMP3IOError);
sMP3.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, onMP3SecurityError);
//incrementTrack();
mcStormHolder.mcInfoBar.txInfo.text = String(aMP3Tracks[iCurrTrack][1] + " - " + aMP3Tracks[iCurrTrack][2]);
mcStormHolder.mcInfoBar.txInfo.autoSize = TextFieldAutoSize.LEFT;
mcStormHolder.mcInfoBar.txInfo.x = 50;
//Record Song if for songs that did not play
scriptVars.var1 = "0+" + String(aMP3Tracks[iCurrTrack][0]);
scriptVars.var2 = (scriptDate);
scriptRequest.method = URLRequestMethod.POST;
scriptRequest.data = scriptVars;
scriptLoader.load(scriptRequest);
//Record Song if for songs that did not play
//Begin Modification for Roger Stull - Skip song if will not load
abortLoad();
bForceRandom = false;
if (schMP3 != null) {
schMP3.stop();
schMP3.removeEventListener(Event.SOUND_COMPLETE, incrementTrack);
nPausePos = 0;
iCurrTrack = iCurrTrack + 1;
if(iCurrTrack > iNumTracks-1){
iCurrTrack = 0;
}
sMP3 = new Sound();
schMP3 = new SoundChannel();
loadMP3();
}
//End Modification for Roger Stull
}