如何添加一個eventlistener到flash內嵌? (new dojox.embed.Flash
)我試過dojo.connect
和addEventListener
但既不工作dojoox.embed.flash上的dojo eventListener
摘錄:
this.player = new dojox.embed.Flash({
path: 'http://player.soundcloud.com/player.swf?url='+track.stream_url+'&enable_api=true&player_type=engine&object_id='+this.playerId,
width: 5,
height: 5,
id: this.playerId,
name: this.playerId,
minimumVersion: 9,
allowScriptAccess: 'always'
}, dojo.byId('soundcloud_flash'));
這些都不工作:
dojo.connect(this.player.movie, 'onMediaBuffering', function(id, data) { console.log('dfg'); obj.progress(data.percent); });
dojo.connect(this.player.movie, 'onMediaBuffering', dojo.hitch(this, function(id, data){ console.log('ergh'); this.progress(data.percent);}));
dojo.connect(dojo.query(this.player.movie)[0], 'onMediaBuffering', function(id, data) { console.log('yu'); obj.progress(data.percent); });
dojo.connect(dojo.query(this.player.movie)[0], 'onMediaBuffering', dojo.hitch(this, function(id, data){ console.log('er'); this.progress(data.percent);}));
dojo.connect(this.player, 'onMediaBuffering', dojo.hitch(this, function(id, data){ console.log('ubg'); this.progress(data.percent);}));
dojo.connect(dojo.byId(this.player), 'onMediaBuffering', dojo.hitch(this, function(id, data){ console.log('asd'); this.progress(data.percent);}));
dojo.connect(dojo.query(this.player), 'onMediaBuffering', dojo.hitch(this, function(id, data){ console.log('asd'); this.progress(data.percent);}));
dojo.connect(dojo.query(this.player), 'onMediaBuffering', function(id, data){ console.log('hj'); this.progress(data.percent);});
此事件是從聲音雲付款人未來:https://github.com/soundcloud/Widget-JS-API/wiki
這是更簡單。只有dojo.connect纔會受益,如果別人把它連接起來,它不會打破onMediaBuffering定義。 – peller 2010-12-17 15:30:18
我嘗試了dojo.connect,但api正在尋找函數'soundcloud:onMediaBuffering'。使用dojo.connect,將其設置爲'onsoundcloud:onMediaBuffering',這顯然是錯誤的。我不是爲什麼他們只是在他們的Flash中使用ExternalInterface – Ashley 2010-12-17 17:15:49
我瘋狂並忘記了上述方法名稱(請參閱更新)冒號是事件名稱的一部分,其中soundcloud設置特定於jquery和prototype的事件,如果它們加載。除非你使用這些工具包,否則你不應該使用字符串「soundcloud:OnMediaBuffering」。 – peller 2010-12-17 19:45:44