我试图控制一个选项卡中另一个选项卡中播放的声音( Titanium.Media.Sound )。
我想将sound.stop()
,sound.play()
之类的命令发送到其他选项卡。但是我不知道如何访问其他选项卡(.js文件)中的变量。
在尊重最佳实践的同时,有人知道该怎么做吗?
非常感谢
最佳答案
tab1.js,具有以下声音:
var sound = Ti.Media.createSound({
url: file
});
Ti.App.addEventListener('playSound', function(evt) {
sound.play();
});
Ti.App.addEventListener('stopSound', function(evt) {
sound.stop();
});
tab2.js,它控制声音:
Ti.App.fireEvent('playSound');
Ti.App.fireEvent('stopSound');
关于ios - 停止Titanium Appcelerator中其他选项卡的声音,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22331473/