Display text with the name of the panorama loaded

  • Hello!

    I am trying to display a text indicating the name of the street of the panorama displayed.
    I know I can achieve that using the Text plugin and data:

    Code
    <data name="my_title">
    	   <p class="street" align="left">
               <font><b>My street</b></font>
    	   </p>
    	   </data>

    The problem is that I have 30 different streets (and growing), and I don't want to: open-type the name of the street-save-close... 30 times

    I load the panoramas using a google map + actionScript. So all the information I need (the name of the streets) is in the HTML file already. When I click in a marker, it loads the pano.xml file located in the folder "Church Street". Then, how can I make it also displays "Church street" in the panorama?

    A solution would be to modify the data content from the HTML, but that is not possible

    Code
    so.addVariable("data[my_title]....

    It is possible to choose which data I would like to load

    Code
    so.addVariable("plugin[title].html", "data:my_title2");

    But I face the same problem because I have to write 30 data tags with all the street names.

    Any ideas?

    PS: I know that by the time I'm writing this and wait for a possible answer It could be done, but I would like to learn how to do it properly *smile*

    UPDATED:
    If this can be done:

    Code
    <data name="htmldata">
        <b>Hello from Flash HTML</b><br/>
        <a href="event:set(plugin[txt].visible,false);">
        	close this window
        </a>
    </data>

    Maybe I can do something like "event:get(..." ?

  • Always the same story...
    I spent two hours before I gave up and I asked in the forum. Then, I had a break having a cup of tea and when I got back to work I thought: "what if I try this..." and bingo! Solved!

    HTML file:


    Explanation:

    - Load an array with all the street names which is the same name as the folders ---> map_array.js
    - Choose a random one ------> var random_xml
    - Use "random_xml to create a path to the corresponding pano.xml -------> var load_random_xml
    - Use "random_xml" to create a variable to use as html content for the text plugin ----> var custom_name
    - Load a random pano ------> so.addVariable("xml", load_random_xml);
    - Pass the name of the street to the text plugin ------> so.addVariable("plugin[title].html", custom_name);


    XML file

    Sorry If I can't explain it better. Please, ask if you have any questions.

    Cheers!

  • Now that I can make it when the web page loads, I just realised that I need to do the same when I load a panorama clicking in a marker... but it doesn't work!!! *confused*

    This is my dode to load a new panorama (which works perfectly)

    Code
    function load_virtualtour(i){
                    krpano().call("loadpano(%HTMLPATH%/panos/" + gmarkers[i].myname + "/pano.xml,null,,BLEND(1);");				
                    }



    And this is what I tried

    Code
    function load_virtualtour(i){
                    krpano().call("loadpano(%HTMLPATH%/panos/" + gmarkers[i].myname + "/pano.xml,null,,BLEND(1);");
    		krpano().set("plugin[title].html", hello world);
                    }

    According to the APi documentation there is no chance to modify the html attribute.

    Code
    krpano().set("plugin[].html

    Any ideas?

    Thank you!

    UPDATE:

    Using the following function function, I can set the view and load a new panorama, but I cannot change the html attribute: *cry*

    Code
    function load_leicester_virtualtour(i){
    		krpano().set("view.fov", "120");
                    krpano().set("plugin[title].html", "hello2");
    		krpano().call("loadpano(%HTMLPATH%/panos/Leicester/" + gmarkers[i].myname + "/pano.xml,null,,BLEND(1);");
                    }

    I give up. I will edit the 30 files editing the xml files

    Code
    <!-- title -->
    	<data name="my_title">
    	   <p><font><b>Name of the street</b></font></p>
    	</data>

    This is how it looks like: Gorilla index

  • Sorry, I 've complicated this post too much... *confused*

    is this possible?

    Code
    krpano().set("plugin[title].html", "Charles Street");

    The following javascript code can load a new panorama and change the fov, but it doesn't change the html content to "Charles Street"

    Code
    function load_leicester_virtualtour(i){
    		krpano().set("view.fov", "120");
                    krpano().set("plugin[title].html", "hello2");
    		krpano().call("loadpano(%HTMLPATH%/panos/Leicester/" + gmarkers[i].myname + "/pano.xml,null,,BLEND(1);");
                    }

    Thanks for your helping!

  • Hi,

    when you put this in your pano.xml ( so in every xml that is an pano...


    and then in the corresponding action..

    Code
    <action name="moveto5">
    		....
    .....
    ....
    		showtext(get(data[infotext].content), infostyle)
    	</action>


    does that work??

    Cheers

    Tuur *thumbsup*

  • Hi Tourvista,

    Your code:

    Code
    function load_leicester_virtualtour(i){
    krpano().set("view.fov", "120");
    krpano().set("plugin[title].html", "hello2");
    krpano().call("loadpano(%HTMLPATH%/panos/Leicester/" + gmarkers[i].myname + "/pano.xml,null,,BLEND(1);");
                    }

    Perhaps you can try to put the set("plugin[title].html", "hello2") after the call("loadpano(.....

    Code
    function load_leicester_virtualtour(i){
    krpano().set("view.fov", "120");
    krpano().call("loadpano(%HTMLPATH%/panos/Leicester/" + gmarkers[i].myname + "/pano.xml,null,,BLEND(1);");
    krpano().set("plugin[title].html", "hello2");
    }

    Hope this can help.

    Salut.

    Edited once, last by michel (June 23, 2009 at 1:36 PM).

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!