Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

How to use addEventListener('load') ?

Hi,

I want to do something like this when my app loads:

app.addEventListener('load', function(){
alert("this is a message");
});

However this just gets me this error "Can't find variable: app at app.js" ?

Any help would be appreciated - I'm fairly new at this :-)

— asked November 20th 2010 by Christian Sørensen
  • addeventlistener
0 Comments

1 Answer

  • Accepted Answer

    You need to do it this way:

    Titanium.App.addEventListener('load', function () { 
         alert("this is a message"); 
    });
    
    — answered November 20th 2010 by Tim Poulsen
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.