2011-03-14 205 views
0

嗯,这可能是很多要问在这里,但我一直试图做几个小时,并不能得到它的工作....请帮助。有没有办法停止从flash_mp3_player的其他播放器实例播放mp3?

首先,我需要把多个MP3播放器在我的网页,所以我下载的播放器在http://flash-mp3-player.net/。我正在使用迷你版和多版本...所以,当迷你开始播放时,我想多关闭。

我认为最好的办法是修改的Flash文件使用的localConnection并触发停止功能,但我不能在所有访问停止功能...我的代码是这样的

在Mini templateA类:

public function playRelease() 
    {  
     trace("playing clicked....test"); 
     var talkingLC:LocalConnection = new LocalConnection(); 
     talkingLC.send("simpleRequest_lc", "stopPlayingPls"); 
     this.player.play(); 
     if (this.player.getLoading().percent != 100) { 
      this.startLoading(); 
     } 
    } 

而且在模板多的好... TemplateMulti.as构造:

var listeningLC:LocalConnection = new LocalConnection(); 
     listeningLC.stopPlayingPls = function() { 
      trace("Execute stopping routine "+this.parent._width); 
      trace(MovieClip[this.parent]); 
      /*stopRelease(); 
      super.stopRelease(); 
      this._enableButton(this._stopButtonInstance, false); 
      this._enableButton(this._pauseButtonInstance, false, true); 
      this._enableButton(this._playButtonInstance, true); 
      delete this._sliderInstance.onEnterFrame; 
      this._sliderInstance.bar_mc._x = 0; 

      this.updatePlaylist();*/ 
     }; 
     listeningLC.connect("simpleRequest_lc"); 

现在我可以同时获得的痕迹,这意味着使用LocalConnection工作了,我也可以写this.stopRelease()的listeningLC块....这外面的工作,但我不能从stopPlayingPls函数中访问stopRelease()功能。

哦,与this回报undefined跟踪.....任何想法吗?

回答

0

如果使用JavaScript,然后在浏览器可以与其他SWF实例的连接。继续你正在使用的路径,但利用Flash的本地功能来分派和侦听浏览器中的JS事件。

相关问题