简体   繁体   English

是否可以从外部文件控制流光?

[英]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.

相关问题 禁用单击外部JS文件中的ASP控件texbox - Disable click on a asp control texbox from an external JS file 从外部javascript文件获取用户控件的clientid - Get clientid in user control from external javascript file 在ASP.NET中,可以在外部JavaScript文件中使用“ &lt;%= control.ClientID%&gt;”,还是必须将其作为脚本块放在ASPX本身中? - In ASP.NET, is it possible to use the '<%= control.ClientID %>' in an external javascript file or must it be in the ASPX itself as script block? 是否可以使用extendscript从外部illustrator文件加载对象属性 - Is it possible to load object properties from an external illustrator file using extendscript 是否可以在外部.js文件中引用我的代码隐藏变量? - Is it possible to reference a variable from my codebehind in an external .js file? 是否可以从外部javascript文件调用Razor @function? - Is it possible to call Razor @function from external javascript file? 是否可以从 alpineJS 中的外部 js 文件中引用代码? - Is it possible to reference code from an external js file in alpineJS? 可以使用 PHP 从外部 HTML 文件中获取 javascript 变量 - It's possible to grab javascript variable from an external HTML file with PHP 是否可以从Fuseki控制面板上传Fuseki中的文件? - Is it possible to upload file in Fuseki NOT from Fuseki Control Panel? Web用户控件中的外部JS文件? - External JS file in web user control?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM