Titanium Community Questions & Answer Archive

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

First Answer gets an ice cream!

not really,

I'm using web view, and I'm trying to implement Shake Gesture Could you tell me how I get this working?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>ok?</title>
</head>

<body><script>Ti.Gesture.addEventListener('shake',function(e)
{
    Titanium.UI.createAlertDialog({title:'Shake',message:'it worked!'}).show();
});
</script>test for sucess
</body>
</html>

Thank you in advance!

— asked April 9th 2010 by London iPhone Developer Butler
0 Comments

2 Answers

  • I'm not sure, but I don't think you're able to chain methods.

    So, if that's true, you would need to var the alert, and then you can invoke the show method on the var. See below:

    var myAlert = Titanium.UI.createAlertDialog({title:&#39;Shake&#39;,message:&#39;it worked!&#39;}); myAlert.show();

    I would try that. If it works, I'll have two scoops of rocky road, please. :)

    — answered April 9th 2010 by Ben Babics
    permalink
    0 Comments
  • I think you will need to "read" the shake event in titanium and apply it to the webview using events.
    take a look at this post to see how to communicate from and to webview

    https://developer.appcelerator.com/question/10671/webview-dom

    — answered April 9th 2010 by Dan Tamas
    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.