Quantcast
Channel: Appcelerator Developer Center Q&A Tag Feed (ti.app)
Viewing all articles
Browse latest Browse all 15

WebView event problem

$
0
0

Hello,

I cannot access the Ti.App var inside a webview.

My code is similar to

Ti.App.addEventListener('btnClicked', function(e) {
    alert('Test');
});
 
var WebView = Ti.UI.createWebView({
    width: 320,
    height: 480,
    touchEnabled: true,
    html: '<div style="width:100px;height:20px;background:#000;" onclick="alert(\'You clicked the button!\');Ti.App.fireEvent(\'btnClicked\');"></div>'
});
 
mainWindow.add(WebView);
WebView.show();
My problem is, the btnClicked event won't fire if I click the button. But the alert "You clicked the button!" appears.

Viewing all articles
Browse latest Browse all 15

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>