Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 544
  • Last Modified:

VRML anchor problem

I have a VRML file with specific viewpoints.  Is it possible to be able to link one of these viewpoints to display a *.html file in another target frame.  That is - I want a picture to appear in a different frame, WHEN I click to move on to my next viewpoint.

I had tried simply to wrap an anchor round my Perspective camera node, and although i got no errors, I got no results either!!

I would much appreciate any suggestions.....
0
garyennis
Asked:
garyennis
  • 7
  • 6
1 Solution
 
julio011597Commented:
When you activate a Viewpoint, as far as i've understood it, the Viewpoint sends an isBound eventOut TRUE.

So you could simply trap this event in a Javascript script to open the desired page.
0
 
garyennisAuthor Commented:
Appreciate the response julio, but any chance of giving an axample of the script.....  I've never come across this isBound eventOut stuff before, nor have I used Javascript and VRML together (seperate yes, but together no!).

Thanks!
0
 
julio011597Commented:
 Hello back.

Well i had some troubles because _everything_is_case_sensitive!, and the specs are not very stable.

Anyway here is a template, asuuming there's an existing "FRAME_0" frame as target:

--//--
#VRML V2.0 utf8

Group {
  children [

    DEF OpenUrl Script {
      eventIn SFBool isBound
      field MFString AUrl "http://some.site.com"
      field MFString AParameter "target=FRAME_0"
      url "javascript:
        function isBound(val) {
          if(val) {
            Browser.loadURL(AUrl, AParameter);
          }
        }
      "
    }

    Viewpoint {
      description "V0"
    }
    DEF V1 Viewpoint {
      description "V1"
    }

  ]
}

ROUTE V1.isBound TO OpenUrl.isBound
--//--

Now, each time you select the "V1" Viewpoint, an AUrl is loaded in frame "FRAME_0".

Hope this is what you're looking for.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
garyennisAuthor Commented:
Quick question to Julio before i give you the points....

I see your code is for VRML ver2.  Will it also work in ver1, if not, any work-arounds?

Cheers!
0
 
julio011597Commented:
No, VRML ver1 does not support any kind of dynamic stuff, and i'm afraid there's no workaround.

This is because of design philosophy: in the VRML development process, only one particular area was to be attacked with each major version; VRML 1.0 was designed to be static scenes only; version 2 introduced animation and programmable behaviour.

Regards and good work.

P.S. BTW, when you want to add comments without rejecting an answer (e.g., if you need clarifications), just write your comment and hit submit without checking any grading box.
0
 
garyennisAuthor Commented:
Julio, if I had any more points to give I would!!

Thanks for the time and patience...!  Although I'm only developing in VRML 1 at the mo., your comments will help greatly when we eventually do decide to upgrade!!

Thanks again!
0
 
garyennisAuthor Commented:
Julio, tried your code now that we're working with VRML2.

Looks like it would work, but am getting an arror after I've clicked the viewpoint - "Script node OpenUrl: No supported script format specified"

Any comments, please advise....Thanks, Gary
0
 
julio011597Commented:
Really, don't know.

I have CosmoPlayer2.0 on Communicator4.0.

May the problem have to do with your configuration?
(because that sample works for me!)
0
 
garyennisAuthor Commented:
Julio......

Looking for another way around this....(for 100 points!)

Is it possible to do it using a technique like the one you gave me for displaying both a htm and wrl file from a anchor in the vrml file. (using    

Anchor { url
"javascript:top.jump('htm file','wrl file')"    etc.etc...


The reason is that i still get the above error when implementing your code above AND i will be setting up a number of views which i want to automatically display pictures, - dont want to write to much code, so using some sort of function might speed things up....

Any ideas???

0
 
julio011597Commented:
Please, try this one first:

--//--
#VRML V2.0 utf8

DEF V0 Viewpoint {
  description "V0"
}
DEF V1 Viewpoint {
  description "V1"
}

Group {
  children [
  ]
}

DEF SC Script {
  eventIn SFBool V0_isBound
  eventIn SFBool V1_isBound

  field MFString V0_URL "V0.gif"
  field MFString V1_URL "V1.gif"

  field MFString VPar "target=AFrame"

  url "javascript:
    function V0_isBound(val) {
      if(val) Browser.loadURL(V0_URL, VPar);
    }
    function V1_isBound(val) {
      if(val) Browser.loadURL(V1_URL, VPar);
    }
  "
}

ROUTE V0.isBound TO SC.V0_isBound
ROUTE V1.isBound TO SC.V1_isBound
--//--

The bad news is that there's no easy way to avoid a lot of code typing.

Let me know, julio
0
 
garyennisAuthor Commented:
heres the deal....

The code works fine for CP2 on the PC, but most of my development is done on the unix with an older version of cosmo which apparently doesnt like any javascript script (only vrml script) and therefore doesnt like the browser.LoadURL command!!!!

(gives the same error as before!)

Ant possible ideas using older specifications, which would work on all systems????
0
 
julio011597Commented:
First a doubt: Javascript is case-sensitive, so

 browser.LoadURL()

if fact *is* wrong, because it should look like:

  Browser.loadURL()

Anyway, you are probably right about your browser handling VRMLScript only, but, then, i have no idea of how to work out the problem. An Anchor would work, but - AFAIK - there's no way to ROUTE a Viewpoint isBound to an Anchor...

Have you got a reference to a VRMLScript tutorial on-line, for me to have a look at it, given that i couldn't find any with search engines?

-julio
0
 
garyennisAuthor Commented:
Julio..... problem solved...

I upgraded our version of cosmoplayer to 1.02 for the unix, and unlike the last one, this does support Browser.loadURL() with Vrmlscript!!!

Thanks anyway for the help...., I'll post 100 points for you in the "lounge" ok...

Cheers again!!!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 7
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now