Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- app.js:
- var win = Ti.UI.createWindow({
- title: "Test",
- navBarHidden: false
- });
- var view = Ti.UI.createWebView({
- url: "test.html"
- });
- win.add(view);
- win.addEventListener('open', function(e) {
- win.activity.invalidateOptionsMenu();
- var actionBar = win.activity.actionBar;
- actionBar.title = win.title;
- actionBar.displayHomeAsUp = true;
- actionBar.onHomeIconItemSelected = function() {
- win.fireEvent('mytest');
- };
- });
- win.addEventListener('mytest', function() {
- Ti.API.info("'mytest'");
- view.evalJS("doTest()");
- });
- win.open();
- test.html:
- <html>
- <head>
- <script type="text/javascript" src="test.js"></script>
- </head>
- <body>
- Tap the ActionBar back arrow.
- </body>
- </html>
- test.js:
- function doTest()
- {
- Ti.API.info("doTest()");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement