Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 AS3 MP3播放器在本地打开时加载,但不';我的服务器上根本没有显示_Actionscript 3_Mp3 - Fatal编程技术网

Actionscript 3 AS3 MP3播放器在本地打开时加载,但不';我的服务器上根本没有显示

Actionscript 3 AS3 MP3播放器在本地打开时加载,但不';我的服务器上根本没有显示,actionscript-3,mp3,Actionscript 3,Mp3,我有一些老师不久前给我的AS3 MP3代码,当我在我的计算机上本地加载网站时,它可以完美地加载,但是我将网站上传到了我的服务器上,MP3根本没有加载,但是网站的其余部分可以。因为我不擅长AS3,也不了解正在发生的一切,所以我只想完整地发布MP3代码,以防你们中的任何人发现它为什么不能在线加载。顺便说一下,我只从bluehost.com购买了基本的服务器空间。我没有购买媒体服务器(我真的不知道它是做什么的)。这可能是问题所在吗 var songList:Array = new Array("InB

我有一些老师不久前给我的AS3 MP3代码,当我在我的计算机上本地加载网站时,它可以完美地加载,但是我将网站上传到了我的服务器上,MP3根本没有加载,但是网站的其余部分可以。因为我不擅长AS3,也不了解正在发生的一切,所以我只想完整地发布MP3代码,以防你们中的任何人发现它为什么不能在线加载。顺便说一下,我只从bluehost.com购买了基本的服务器空间。我没有购买媒体服务器(我真的不知道它是做什么的)。这可能是问题所在吗

var songList:Array = new Array("InBackRoom.mp3", "NoMeansYes.mp3");
var isPlaying:Boolean = false;
var currentSong:Number = 0;
var song:Sound;
var channel:SoundChannel = new SoundChannel();
var xform:SoundTransform = new SoundTransform();

seekKnob.buttonMode = true;
seekKnob.addEventListener(MouseEvent.MOUSE_DOWN, seekStartDrag);
btnPrev.addEventListener(MouseEvent.CLICK, prevHandler);
btnPause.addEventListener(MouseEvent.CLICK, pauseHandler);
btnPlay.addEventListener(MouseEvent.CLICK, playHandler);
btnNext.addEventListener(MouseEvent.CLICK, nextHandler);
volumeKnob.buttonMode = true;
volumeKnob.addEventListener(MouseEvent.MOUSE_DOWN, volumeStartDrag);

function prevHandler(evt:MouseEvent):void {
    prevSong();
}

function pauseHandler(evt:MouseEvent):void {
    pauseSong();
}

function playHandler(evt:MouseEvent):void {
    playSong(channel.position);
}

function nextHandler(evt:MouseEvent):void {
    nextSong();
}

function id3Handler(evt:Event):void {
    songInfo.text = /*song.id3.artist + ": " +*/ song.id3.songName;
}
function soundCompleteHandler(evt:Event):void {
    pauseSong();
    nextSong();
}

loadSong(songList[currentSong]);

function loadSong(thisSong:String):void {
    song = new Sound();
    song.load(new URLRequest(thisSong));
    song.addEventListener(Event.ID3, id3Handler);
    /*playSong(0);*/
}

function playSong(position:Number):void {
    if (!isPlaying) {
        isPlaying = true;
        channel = song.play(position);
        channel.soundTransform = xform;
        channel.addEventListener(Event.SOUND_COMPLETE, soundCompleteHandler);
        seekKnob.addEventListener(Event.ENTER_FRAME, seekKnobUpdate);
    }
}

function pauseSong():void {
    seekKnob.removeEventListener(Event.ENTER_FRAME, seekKnobUpdate);
    channel.stop();
    isPlaying = false;
}

function prevSong():void {
    if (currentSong > 0) {
        currentSong--;
        pauseSong();
        loadSong(songList[currentSong]);
    }
}

function nextSong():void {
    if (currentSong < songList.length - 1) {
        currentSong++;
        pauseSong();
        loadSong(songList[currentSong]);
    }
}

function seekStartDrag(evt:MouseEvent):void {
    pauseSong();
    seekKnob.startDrag(true, new Rectangle(seekSlider.x, seekSlider.y + seekSlider.height/2, seekSlider.width, 0));
    stage.addEventListener(MouseEvent.MOUSE_UP, seekStopDrag);
}

function seekStopDrag(evt:MouseEvent):void {
    seekKnob.stopDrag();
    playSong(song.length * (seekKnob.x - seekSlider.x) / seekSlider.width);
    stage.removeEventListener(MouseEvent.MOUSE_UP, seekStopDrag);
}

function seekKnobUpdate(evt:Event):void {
    var pos:Number = seekSlider.width * channel.position / song.length;
    if (!isNaN(pos)) {
        seekKnob.x = seekSlider.x + pos;
    } else {
        seekKnob.x = seekSlider.x;
    }
}

function volumeStartDrag(evt:MouseEvent):void {
    volumeKnob.startDrag(true, new Rectangle(volumeSlider.x, volumeSlider.y + volumeSlider.height/2, volumeSlider.width, 0));
    volumeKnob.addEventListener(MouseEvent.MOUSE_MOVE, volumeUpdate);
    stage.addEventListener(MouseEvent.MOUSE_UP, volumeStopDrag);
}

function volumeStopDrag(evt:MouseEvent):void {
    volumeKnob.removeEventListener(MouseEvent.MOUSE_MOVE, volumeUpdate);
    volumeKnob.stopDrag();
    stage.removeEventListener(MouseEvent.MOUSE_UP, volumeStopDrag);
}

function volumeUpdate(evt:MouseEvent):void {
    xform.volume = (volumeKnob.x - volumeSlider.x) / volumeSlider.width;
    channel.soundTransform = xform;
}
var-songList:Array=新数组(“InBackRoom.mp3”、“NoMeansYes.mp3”);
变量显示:布尔值=false;
var currentSong:Number=0;
歌曲:声音;
var通道:SoundChannel=新的SoundChannel();
var-xform:SoundTransform=new-SoundTransform();
seekKnob.buttonMode=true;
seekKnob.addEventListener(MouseEvent.MOUSE_DOWN,seekStartDrag);
btnPrev.addEventListener(MouseEvent.CLICK,prevHandler);
btnPause.addEventListener(MouseEvent.CLICK,pauseHandler);
btnPlay.addEventListener(MouseEvent.CLICK,playHandler);
btnNext.addEventListener(MouseEvent.CLICK,nextHandler);
volumeKnob.buttonMode=true;
volumeKnob.addEventListener(MouseEvent.MOUSE_DOWN,volumeStartDrag);
函数prevHandler(evt:MouseEvent):void{
prevSong();
}
函数pauseHandler(evt:MouseEvent):无效{
暂停();
}
函数playHandler(evt:MouseEvent):void{
播放歌曲(频道位置);
}
函数nextHandler(evt:MouseEvent):void{
nextSong();
}
函数id3Handler(evt:事件):无效{
songInfo.text=/*song.id3.artist+”:“+*/song.id3.songName;
}
函数soundCompleteHandler(evt:Event):void{
暂停();
nextSong();
}
loadSong(歌曲列表[当前歌曲]);
函数loadSong(thisSong:String):void{
歌曲=新声音();
加载(新URL请求(thisSong));
song.addEventListener(Event.ID3,id3Handler);
/*播放歌曲(0)*/
}
功能播放歌曲(位置:编号):无效{
如果(!显示){
isplay=true;
频道=歌曲播放(位置);
channel.soundTransform=xform;
channel.addEventListener(Event.SOUND_COMPLETE,soundCompleteHandler);
seekKnob.addEventListener(Event.ENTER_FRAME,seekKnobUpdate);
}
}
函数pauseSong():void{
参见kknob.removeEventListener(Event.ENTER_FRAME,参见kknobupdate);
channel.stop();
isplay=false;
}
函数prevSong():void{
如果(当前歌曲>0){
当前歌曲--;
暂停();
loadSong(歌曲列表[当前歌曲]);
}
}
函数nextSong():void{
如果(currentSong

我检查过了,所有内容都上传了,并且文件结构都是正确的。

没有必要使用媒体服务器。使用web调试器(如Firebug)查看是否正在请求MP3文件、请求的位置以及响应是否合适。url中的大小写敏感度可能很简单。

您有任何错误吗?如果您使用Flash Player的调试版本(adobe.com/support/flashplayer/downloads.html),您应该会看到错误。我想象可能是IOError或SecuritySandbox错误。我不认为可能是这样,因为我使用fireFTP上传了所有内容…这意味着我只是点击并拖动了所有内容,从在我的计算机上运行的文件到我在线的文件空间…我将检查所有内容,但我相对确定如果有url或大小写灵敏度本来是关闭的,在本地我的电脑上是不会工作的。我用的是firebug,但我不知道你可以用flash?!在浏览器中,所有请求都是通过浏览器发出的。Flash也不例外,它通过浏览器发出所有请求。因此,您可以使用Firebug监视Flash发出的请求和相应的响应。