JavaScript, Browser Object, VR with Hotspots?
Mike Bonner
bonnmike at gmail.com
Thu Feb 2 22:56:23 EST 2017
Hmm. NO easy way to see the critical stuff from here but I found this post.
https://ggnome.com/forum/viewtopic.php?f=6&t=9123&p=35818&hilit=custom+function+hotspot#p35818
I think the key is to do similar to what is being done in the post.
Basically,pass the value of me.hotspot.id to livecode as part of the
function call, and add a switch block that gives a message based on the
hotspot id. Very hard to actually test anything from here, but maybe there
is something useful in the post.
On Thu, Feb 2, 2017 at 8:12 PM, JOHN PATTEN via use-livecode <
use-livecode at lists.runrev.com> wrote:
> Hi All,
>
> I managed to trial and error together a working html5 panorama using
> Pan2VR (http://ggnome.com/pano2vr <http://ggnome.com/pano2vr>). The
> interface of their software allows you to attach a javascript action to a
> vr hotspot. The interface creates the following javascript for the hotspot
> to trigger the LiveCode handler:
>
> this._svg2.onclick=function (e) {
> window.addEventListener('click',
> function() {liveCode.myLiveCodeHandler2();});
> }
>
> (svg2 is the hotspot icon).
>
> The hotspot in the vr adds some text to a field on the card when clicked,
> waits 2 seconds, and then removes the text.
>
> This javascript works only the first time, because after the hotspot is
> clicked, the LiveCode handler is triggered any time the user clicks within
> the vr of the browser object. (Javascript “event listener” listens for any
> click in the browser object, after the hotspot is clicked once.)
>
> The only solution I have found is to reload the html for the vr into the
> browser object again. But that is not ideal.
>
> I am aware of a the javascript command removeEventListener, and that
> appears to be what I need, however I am not sure how I would go about and
> use the script? Its appears that “this.” is defined in the js as the
> hotspot, and _svg2 is the hot spot ID, but everything I have tried to
> cobble together to apply this command has not worked. I’m not sure where it
> should even be located in the process?
>
> I’ve shared the LiveCode project and VR files here:
> https://dl.dropboxusercontent.com/u/6767916/VR_and_Javascript_Example.zip
> <https://dl.dropboxusercontent.com/u/6767916/VR_and_Javascript_Example.zip
> >
>
> Any help is greatly appreciated!
>
> John Patten
> SUSD
>
>
>
> > On Jan 30, 2017, at 8:01 PM, Mike Bonner via use-livecode <
> use-livecode at lists.runrev.com> wrote:
> >
> > Depending on what version of LC you're using,k and if you're using the
> > widget, or openrevbrowser
> > look at revBrowserAddJavascriptHandler in the dictionary.
> >
> > If using the widget, use the dropdown to select the browser widget in the
> > dictionary and look at the javascripthandlers property.
> >
> >
> >
> > On Mon, Jan 30, 2017 at 8:22 PM, JOHN PATTEN via use-livecode <
> > use-livecode at lists.runrev.com <mailto:use-livecode at lists.runrev.com>>
> wrote:
> >
> >> Hi All,
> >>
> >> I’m not sure if this is possible with Livecode, but I thought I’d ask
> >> anyways.
> >>
> >> I have a html5 panorama I created in a trial version of Pano2VR. I
> posted
> >> it up here: http://jpatten.on-rev.com/vrjs/index.html <
> http://jpatten.on-rev.com/vrjs/index.html> <
> >> http://jpatten.on-rev.com/vrjs/index.html <http://jpatten.on-rev.com/
> vrjs/index.html>>
> >>
> >> This pano has one hot spot that just throws a JavaScript alert, “Hello
> >> World.” So I know I can create a Javascript inside a hotspot in the
> pano
> >> using the Pano2VR app.
> >>
> >> Here are my questions.
> >>
> >> 1. Can Livecode intercept the Javascript result in the browser object
> and
> >> act on it? If it can, I’m guessing I could have it return text and then
> >> have Livecode run an action. Something like… if varText = “picture 1”
> >> then, show picture one … else/switch if vartex = "picture 2" then open
> >> "picture 2", etc. etc. etc.
> >>
> >>
> >> 2. I would like to have hotspots in a panoramic image run JavaScripts
> that
> >> LiveCode intercepts, and then act on what it catches to runs scripts in
> the
> >> stack. One hot spot might open and image. Another might open a substack,
> >> etc. etc. all within the LiveCode project. The Browser Object is used
> only
> >> to present the panoramic image, and the pano image acts as s pseudo
> >> navigation object for additional content.
> >>
> >> Anybody have a simple example of what the Javascript in the pano might
> >> look like, as opposed to just an alert? What scripts would I use to
> capture
> >> and act on the Javascript in the browser object?
> >>
> >> Or, maybe this is not possible…?
> >>
> >> Thank you!
> >>
> >> John Patten
> >> SUSD
> >>
> >>
> >>
> >>
> >>
> >> _______________________________________________
> >> use-livecode mailing list
> >> use-livecode at lists.runrev.com <mailto: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 <
> http://lists.runrev.com/mailman/listinfo/use-livecode>
> > _______________________________________________
> > use-livecode mailing list
> > use-livecode at lists.runrev.com <mailto: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 <
> http://lists.runrev.com/mailman/listinfo/use-livecode>
> _______________________________________________
> 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