variable in textfield / plugin

  • Hi,

    i lik e to make a variable in my textfield as it is a plugin..

    i have this:

    on line 5 you can see what i want... is that possible?


    anybody??

    a while ago we fixed this with a hotspot...http://www.krpano.com/forum/wbb/inde…d&threadID=2948
    but will this also work now??
    i can't get it..

    thanx

    tuur *thumbsup*

  • i want to find a way to make the text a variable right now i have to have a data set for each hotspot. if i could make that a variable it could be done with 1 action. i need the image path to be a variable also.

    <data name="cpaerial">
    <textformat leftmargin="10" rightmargin="10">
    <p align="center">
    <font face="times" size="+1">
    <b>Canal Park Aerial 360</b>
    </font>
    </p>
    <a href="event:action(s0);">
    <img vspace="1" src="thumbs/panorama.jpg" />
    </a>
    </textformat>
    </data>

    <data name="cpboyngull">
    <textformat leftmargin="10" rightmargin="10">
    <p align="center">
    <font face="times" size="+1">
    <b>Boy and Gull Statue</b>
    </font>
    </p>
    <a href="event:action(s1);">
    <img vspace="1" src="thumbs/cpboyngull.jpg" />
    </a>
    </textformat>
    </data>

    Edited once, last by VN2009 (October 5, 2010 at 5:57 PM).

  • m mmm...
    i tried to do it as we diid here with a hotspot.. http://www.krpano.com/forum/wbb/inde…d&threadID=2948

    ...

    oke now i have:


    offcourse i put the actions also in the onstart..

    Pinsane!!! HEEEEELLLLP

    what is going wrong??

    Cheers

    Tuur *thumbsup*

  • oke this works!!!!

    only the picture doesn't show... *confused* *confused* *confused* *confused*


    and in the onstart.. you put this

    action(text_var);
    action(style_var);

    after the load action of the first pano..


    But why doesn't my picture show... *confused*

    Cheers
    Tuur *thumbsup*

  • Glad you got it working tuur!

    Here's a different approach that you might find useful. I too found that the image would dissappear if you used an action to write the contents of a data field. I'm still not sure I understand how to get around that issue. Are you using full blown url paths to remedy the problem?

    At any rate, here's a solution that does what you asked for and seems to preserve the images as well. It allows you to put get statements in a data node, and automatically replace the get statements with the values of the variable. I've taken the liberty of including an example using your html data node:

    Code
    <data name="thumb1">
    		<p align="middle"><font face="Verdana"   size="11"><textformat leftmargin="" rightmargin="">
    		<img src="../thumbs_lanterna/lanterna1.jpg" height="" width="" align="top"/>
    		here i like to have something like :
    			the language is get(language) <br/> <b> get(phrase[thumb1].language[get(language)].text) </b><br/>
     		but then that it works.. ??
    	
    	            </textformat></font></p>     
    </data>


    Note that there is both a simple get statement (get(language)), and a very complicated one (get(phrase[thumb1].language[get(language)].text) embedded in the html. The second get statment accesses the appropriate language via an associative array I'll describe later.

    First, the following javascript needs to be included in your tour:


    These functions allow you to place get() statements inside your data node, and then replace them with their values on demand simply by calling kr_eval_get_in_string with the argument data[thumb1].contents.

    I'm including an example that shows how you can build an associative array to manage the language customization.

    Code
    <phrase name="thumb1" >
    		<language name="dutch" text="goedemorgen" />
    		<language name="english" text="good morning" />
    		<language name="spanish" text="buenas días" />
    		<language name="japanese" text="ohayou gozaimasu" />
    		<language name="french" text="bonjour" />
    		<language name="german" text="guten morgen" />
    		<language name="pig_latin" text="oodgay orningmay" />
    	</phrase>

    Note that by using this approach you can handle multiple languages in the onhover event for with a relatively clean xml command:

    Code
    <plugin name="foo"
    	...
    	onhover="showtext(get(phrase[get(name)].language[get(language)].text)"
    	...


    Here we access the appropriate associative array by naming it with the same name as the plugin, then we access the appropriate language using a global variable named language.

    Here's a working example xml file that allows you to change the language on-the-fly using a combobox selector. Note that the default language value is set in the first line:

    Hope this helps!

    steve

  • He Master!

    Quote

    Are you using full blown url paths to remedy the problem?

    no just the right name of the picture.

    Wow Steve, that's a code.. *love*

    thanx so much for your time and input.

    When i read the code i even understand most of it *wink* and that for a dutch ;-P
    Gonne use this for sure!
    But this webside makes before visiting the tour a language selection for the tour.
    And i know that i can fix that aswell but i got it running for now so i keep that..

    That style name thing iforgot... that's a goo done aswell *wink*

    so, thanx again and for the next tour i'll gonna learn this code and check/test it out!

    Cheers

    Tuur *thumbsup*

Participate now!

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