calc: and get: in text layer html

  • hi there
    looks like the code doesn't work anymore in krpano 1.20.9

    Code
    ...
    html="get:scene[get(xml.scene)].title"
    ...


    returns nothing

    trying to calc the title of a tour and the scene's title

    Code
    ...
    html="calc:'[i]' + title + '[/i][br]' + get:scene[get(xml.scene)].title"
    ...

    returns:
    "ERROR: Invalid expression: '' + title + '[br]' + get:scene[get(xml.scene)].title"


    by the way

    Code
    <events onkeydown="showlog(); trace(get(scene[get(xml.scene)].title));" />

    Code
    html="calc:'[i]' + title + '[/i]'"


    works fine

    any advice, please

  • you cant combine calc: and get: in one expression
    i guess correct would be:

    Code
    html="calc:'[i]' + title + '[/i][br]' + scene[get(xml.scene)].title"


    but i also think when the xml gets parsed xml.scene is not defined, yet
    you could test that by checking if this works:

    Code
    html="calc:'[i]' + title + '[/i][br]' + scene[existing_scene_name].title"


    xml.scene is dynamic and calc: / get: is evaluated only once on init
    to do this for every scene you'd need to set up an event action

  • indexofrefraction thank you

    Zitat

    when the xml gets parsed xml.scene is not defined, yet


    Understand now.
    So yep events are great for dynamically changing texts.
    In the end, came up with:

    Code
    <events name="add_event" keep="true"
        onnewscene="set_scene_description();"
    />
    <action name="set_scene_description">
        set(scene_title, get(scene[get(xml.scene)].title));
        set(scene_category, get(scene[get(xml.scene)].category));
        set(layer[scene_description].html, calc('[i]' + title + '[/i][br][strong]' + scene_category + ' — ' + scene_title + '[/strong]'));
    </action>

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!