home

Topics Topics Edit Profile Profile Help/Instructions Help Register Register  
Search Last 1 | 3 | 7 Days Search Search Tree View Tree View  

Calling a JavaScript function from a ...

The Panorama Factory Forum » The Panorama Factory FAQ » Calling a JavaScript function from a hotspot « Previous Next »

Author Message
Top of pagePrevious messageNext messageBottom of page Link to this message

John Strait
Moderator
Username: Jstrait

Post Number: 21
Registered: 5-2001
Posted on Wednesday, October 29, 2003 - 2:58 pm:   Edit PostDelete Post

It is possible to do complex processing when the user clicks a hotspot by calling a JavaScript function. For example, you can use JavaScript o open a web page in a new browser window with a specific size.

I'll demonstrate how to call a JavaScript function from a hotspot in PTViewer and QTVR panoramas. I don't whether the IVR viewers support JavaScript hotspots.

In the example, I'll show how to open a new browser window with a specified size. This is just one example of how JavaScript can be used.

It's beyond the scope of this article to teach JavaScript programming. If you're not familiar with JavaScript programming, you should find a good JavaScript reference. I like the book "JavaScript: The Definitive Guide" from O'Reilly & Associates, Inc.


1. Start by choosing a name for the JavaScript function. Let's use the function name "dopopup".

2. To call dopopup from the hotspot, enter the function call in the URL field of the Hotspot properties dialog box this way:
     javascript:dopopup()

3. Save your panorama, making sure to select the "Create new web page from template" on the Save Image As dialog box.

4. Edit the web page produced by The Panorama Factory to add the dopopup JavaScript function. For example, to open The Panorama Factory's home page in a new window, add this code to your web page:
     <script language="JavaScript"><!--
     function dopopup()
     {
       window.open("http://www.panoramafactory.com",
                   "pfactory_window",
                   "width=640,height=480" +
                   ",menubar=1,toolbar=1,location=1" +
                   ",scrollbars=1,resizable=1");
     }
     // --></script>

immediately after the line
     <body ...>

5. For PTViewer only: You must also enable JavaScript functions by editing the HTML code of your web page. To enable JavaScript, insert the line:
     mayscript=true
after the line:
     archive="ptviewer.jar" code="ptviewer.class"
This web page modification is not necessary for QTVR panoramas.


Note: In this example we opened the window with a specific window name ("pfactory_window") and specific values for width, height, menubar, etc. For more information about the window.open function and about other JavaScript features, please refer to your favorite JavaScript reference material.
Top of pagePrevious messageNext messageBottom of page Link to this message

David Jansen
New member
Username: Djansen

Post Number: 1
Registered: 6-2007
Posted on Tuesday, June 19, 2007 - 12:49 pm:   Edit PostDelete Post

I coded a complete site depending on Javascript. It contains a virtual tour (all done with Panorama Factory) using the method "javascript:function()" in the URL for the hotspots as described here.
Everything works great as long as the user has QT 6 installed.
The "javascript:function()" URLs do not work in QT 7!
Any suggestions?


(Message edited by djansen on June 19, 2007)
Top of pagePrevious messageNext messageBottom of page Link to this message

John Strait
Moderator
Username: Jstrait

Post Number: 305
Registered: 5-2001
Posted on Tuesday, June 19, 2007 - 3:39 pm:   Edit PostDelete Post

Unfortunately, Apple apparently has decided to remove this capability from QuickTime 7 for "security reasons." This is something over which I have no control.

You can read about this change to QuickTime in the article Executing JavaScript Functions From QuickTime which is tucked away in their developer website, developer.apple.com.

Microsoft and Apple have been systematically removing browser-based interactive features for "security reasons" for the last few years now. It has been frustrating for me to try to hit this moving target (see for example, the saga of Internet Explorer security warnings in The Panorama Factory's trouble reports TR 626, TR 659 and TR 684).

One wonders whether Microsoft and Apple are trying to force people to build web applications by purchasing server-side products like Microsoft's .NET and Apple's WebObjects. Or am I being paranoid?

I wish I had a better answer for you. Believe me, I sympathize. I just wish there was something I could do about it.

(Message edited by jstrait on June 19, 2007)
Top of pagePrevious messageNext messageBottom of page Link to this message

David Jansen
New member
Username: Djansen

Post Number: 2
Registered: 6-2007
Posted on Tuesday, June 19, 2007 - 4:02 pm:   Edit PostDelete Post

Thanks for your prompt answer, John.
I will try to use Flash inside Quicktime as described in this (http://vrm.vrway.com/issue14/MULTINODE_QTVR_TOUR_WITH_EMBEDDED_FLASH_NAVIGATION.html) tutorial.
But maybe that is not even necessary. The final result page of this tut (http://www.helloworld.se/qtvr/AulaUppsala.html) has hotspots that load a new QTVR file into the same QT Player frame. You might be able to solve the problem within PF by implementing the appropriate hotspot type.
Or could you recommend a good hotspot editor for my XP Pro platform?
Top of pagePrevious messageNext messageBottom of page Link to this message

John Strait
Moderator
Username: Jstrait

Post Number: 306
Registered: 5-2001
Posted on Tuesday, June 19, 2007 - 5:31 pm:   Edit PostDelete Post

Thanks for the links. I'll check them out.

As for hotspots that load a new QTVR file into the same QT Player frame, I have tended to avoid including QuickTime-specific (or PTViewer-specific, etc) capabilities in the Virtual Tour support. My idea was that you should be able to publish the same Virtual Tour with any of the supported viewers.

And it's also a question of having limited resources. It may surprise you to know that this is a one-and-a-half person company. I am always struggling with spreading myself too thin.

But it might be time to consider adding the capability you suggested. I'll look into the feasabililty of adding it in a future release.


(Message edited by jstrait on June 19, 2007)
Top of pagePrevious messageNext messageBottom of page Link to this message

David Jansen
New member
Username: Djansen

Post Number: 3
Registered: 6-2007
Posted on Friday, June 22, 2007 - 11:45 am:   Edit PostDelete Post

Enabling the QT syntax "<somename.mov> T<myself> E<parameters>" in the URL of PF's hotspots would solve this and many other problems.

At the moment this syntax works only in the form of: <param name="hotspot1" value="<somename.mov> T<myself> E<parameters>">, which is not recursiv.

For further details: http://developer.apple.com/documentation/QuickTime/Conceptual/QTScripting_HTML/QTScripting_HTML_Document/chapter_1000_section_5.html

(Message edited by djansen on June 22, 2007)
Top of pagePrevious messageNext messageBottom of page Link to this message

John Strait
Moderator
Username: Jstrait

Post Number: 307
Registered: 5-2001
Posted on Friday, June 22, 2007 - 12:35 pm:   Edit PostDelete Post

Thanks David. I wasn't aware of this QT syntax.

After reading your message, I tried it by manually editing a web page and it seems to work, mostly. The QT viewer seemed to lose the control bar (zoom in/out buttons, etc), but that's a problem that might be solvable.

Unfortunately, the current version of PF isn't compatible with this method because it encodes special characters in the URL field. So the "<" becomes "%3c", the ">" becomes "%3e" and the " " becomes "%20". And, as you pointed out, the hotspot parameters for the second MOV file would also have to be embedded in the HTML page somehow.

But this might give me a place to start looking for a relatively simple solution. The only other solution I'm aware of is to put all of the panoramas into a multi-node MOV file. This has the nice characteristic that the MOV file will work outside of a web page. But the downside is that it's harder to update a single panorama without rewriting the entire MOV file.

Not to mention that adding support for multi-node MOV files would be a pretty big development job for PF.

But I'll try to investigate the "<somename.mov> T<myself>" method further to see whether PF can use it somehow.

Add Your Message Here
Post:
Bold text Italics Underline Create a hyperlink Insert a clipart image

Username: Posting Information:
This is a private posting area. Only registered users and moderators may post messages here.
Password:
Options: Enable HTML code in message
Automatically activate URLs in message
Action:

Administration Administration Log Out Log Out   Previous Page Previous Page Next Page Next Page