[英]Is it possible to control a streamer from an external file?
I have a radio app that has a play button on one tab, another tab has a list of news items in a table row. 我有一个广播应用程序,其中一个选项卡上有一个播放按钮,另一个选项卡在表行中有新闻列表。 Then if a news item is clicked, I am moving AWAY from my app.js and into an external js. 然后,如果单击新闻项,那么我将从我的app.js移到外部js。 Here I have a news story and a play button also which has commentary on the story. 在这里,我有一个新闻故事和一个播放按钮,其中也有对该故事的评论。 What I need to do is share data between the pages which I think I have sorted (correct me if I'm wrong) using the following code: 我需要做的是使用以下代码在我认为已排序的页面之间共享数据(如果输入错了,请更正):
//in my app.js
var yourArray = [streamer.volume, streamer.STATE_PLAYING];
w.passedArray = yourArray;
//in my external.js
Titanium.UI.currentWindow.passedArray[0];
Titanium.UI.currentWindow.passedArray[1];
in order to determine if the streamer from the main tab is in a 'playing' state and if it is to turn down the volume while playing the news item on the external.js and when this mp3 file is finished streaming to turn back up the volume on the main page's streamer. 为了确定主选项卡中的流媒体是否处于“正在播放”状态,以及是否要在播放external.js上的新闻项时调低音量以及何时完成此mp3文件的流媒体以调回主页的流光上的音量。 I jope I have been clear. 我很高兴我很清楚。 Any help appreciated . 任何帮助表示赞赏。
Here you go method of passing array between windows in titanium. 在这里,您可以在钛合金的窗口之间传递数组的方法。
Suppose it is app.js 假设它是app.js
var myarray = ["one", "two", "three"];
var win = Titanium.UI.createWindow({
title:'Test',
url:'win.js',
myarray:myarray
});
win.open();
and suppose it is win.js 并假设它是win.js
var win = Titanium.UI.currentWindow;
var myarray = win.myarray;
Titanium.API.info(myarray.length); //oddly this outputs '3'
Titanium.API.info(myarray[1]);
thanks 谢谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.