HTML browser and mobile.
Ralph DiMola
rdimola at evergreeninfo.net
Mon Apr 28 22:07:38 EDT 2014
Pierre,
Thank You!! Just what the DR ordered! Works likes a charm on Android. Going
for iOS now.
Ralph DiMola
IT Director
Evergreen Information Services
rdimola at evergreeninfo.net
-----Original Message-----
From: use-livecode [mailto:use-livecode-bounces at lists.runrev.com] On Behalf
Of Pierre Sahores
Sent: Friday, April 25, 2014 2:42 PM
To: How to use LiveCode
Subject: Re: HTML browser and mobile.
Hi Ralph,
The way it works can be really simple (other ways available but this one
fills perfectly my needs
) :
1.- the html/js side :
page1.html need to include some javascript :
simple iOS/Android working example :
> <script type="text/javascript">
> var priogesture = 1, start_x = 0, stop_x = 0, start_y = 0,
stop_y = 0;
> function $(id) { return document.getElementById(id); }
> $("swipe-wrap").addEventListener ("touchstart", function
(event) {
> start_x = event.touches[0].screenX; start_y =
event.touches[0].screenY; priogesture = 0;
> });
> $("swipe-wrap").addEventListener ("touchmove", function
(event) {
> stop_x = event.touches[0].screenX; stop_y =
event.touches[0].screenY;
> if ((priogesture == 0) && (stop_x != 0) &&
(Math.abs(stop_x - start_x) > Math.abs(stop_y - start_y))) {
> if (start_x < stop_x) {
>
document.location.href="file:/data/data/com.pierresahores.alainweiz/cache/pr
ev.html";
> } else if (start_x > stop_x) {
>
document.location.href="file:/data/data/com.pierresahores.alainweiz/cache/ne
xt.html";
> }
> }
> });
> </script>
a.- able to handle the touch messages it receive from your mobile app users;
b.- and initiate a new pageN.html load;
2.- the livecode scripting side :
> on browserLoadRequested pUrl, pType
> if the platform is "iPhone" then
> if "/cache/prev.html" is in pURL then
your iOS dedicated LC code comes there
> on browserStartedLoading pUrl
> if "/cache/prev.html" is in pURL and the platform is "android" then
your Android dedicated LC code comes there
Best,
Pierre
Le 25 avr. 2014 à 19:36, Ralph DiMola <rdimola at evergreeninfo.net> a écrit :
> How would one do a call back to LC from within a mobile web page? Is this
even possible on mobile? I have a html local page with a map image. I would
like to call an LC procedure with a parameter when the user presses within a
specific county on the page.
>
> Ralph DiMola
> IT Director
> Evergreen Information Services
> rdimola at evergreeninfo.net
>
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
--
Pierre Sahores
mobile : 06 03 95 77 70
www.sahores-conseil.com
_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list