Coding_Strategies Error in demo

You must Login before you can answer or comment on any questions.

im walking trough the Coding_Strategies pages and tryed the demo there Why does this give an error?

error

[ERROR] Syntax Error = Parse error at ui.js (line 5)
[ERROR] Script Error = 'undefined' is not an object (evaluating 'myapp.ui.createApplicationWindow') at app.js (line 7).
app.js
// create an object literal to be your app's namespace
var myapp = {};
// include necessary libraries
Ti.include('ui.js', 'other_library.js');
 
// instantiate and open the main UI component of our app
myapp.mainWindow = myapp.ui.createApplicationWindow();
myapp.mainWindow.open();
ui.js
// create a self-calling function
(function(){
    myapp.ui = {}; // this sub-namespace extends the app's namespace object
 
    myapp.ui.createApplicationWindow() {
        var win = Ti.UI.createWindow({
            backgroundColor:'white'
        });
 
        var header = Ti.UI.createLabel({
            text: 'My App Heading',
            top: 10,
            height:'auto',
            width:'auto'
        });
        win.add(header);
        return win;
    };
})();

2 Answers

Accepted Answer

ui.js should read:

myapp.ui.createApplicationWindow = function() {

that fixes it, should have seen that myself do :D

— answered 10 months ago by Gerd Koetje
answer permalink
1 Comment
  • If Adam fixed your problem, please do him the courtesy of marking it as the best answer.

    — commented 10 months ago by Jason Priebe

Your Answer

Think you can help? Login to answer this question!