javascript - Appceletor Titanium createWindow() 无法打开新窗口,错误

标签 javascript titanium

我是 Titanium 3.x 的新手,我已经制作了我的第一个简单的 Titanium 项目。它只是使用另一个 JS 文件打开新窗口。 我在 index.js 中编写代码,如下所示。 我在 app/controllers/中创建新的 js 文件“createnew.js”。

//////////////////////////////////////
button.addEventListener('click',function(e)
{
    var childWindow = Ti.UI.createWindow({
        url: 'createnew.js'
    });
    childWindow.open();

});
///////////////////////////////////////
// createnew.js
///////////////////////////////////////


        var self = Ti.UI.createWindow();

        var overview = Ti.UI.createView({
            width: Ti.UI.FILL,
            height: Ti.UI.FILL,
            backgroundColor: 'yellow'

        });
    self.add(overview);

    self.open();

当运行应用程序时,如果我单击按钮,模拟器中会出现红色错误窗口,表示无法打开createnew.js文件,找不到此类文件或目录。

如何解决这个问题?

我的目标是使移动应用程序的每个页面都作为不同的Js文件,当它进入该页面时,我可以使用调用createWindow()来加载Js文件。 请帮助我。

最佳答案

你写道:

I create new js file "createnew.js" in app/controllers/.

看来您正在遵循Titanium的允许框架。 但从编码风格来看,您似乎正在使用经典的钛结构。

请不要感到困惑,并遵循以下链接中的 Titanium 编码风格:

关于javascript - Appceletor Titanium createWindow() 无法打开新窗口,错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24734560/

相关文章:

javascript - 更新一个 JavaScript 对象会更新所有对象

android - Appcelerator Titan 使用 C2DM 推送通知?

titanium - 在钛合金中调用函数或定位另一个 Controller 中的元素

javascript - jquery能否遍历整个DOM并找到href中的Update一词

javascript - 融合图 每个变量有不同的绘图类型

titanium - 如何更改应用程序名称?

android - 无法构建 Titanium Android 应用程序以在模拟器中进行测试

android - 如何清除 android 中 titanium 应用程序中堆大小的增长?

javascript - 如何解决 "Cannot call method "addL"of undefined"

javascript - 在 iOS 中使用 React Native 的 Google map