Best way to display a text after a new pano is load ?

  • I would like to display a welcome text at the beginning of the tour, and then, a small text (title) to display the name of the current pano

    Something like here : https://krpano.com/examples/108b7…nes/scenes.html

    I've one main xml, and one xml for each pano.

    If I put a

    Code
    onxmlcomplete="action(showtext);"

    on my main xml, it's overridden by the onxmlcomplete in the xml of the pano loaded : I load the first pano with

    Code
    include="pano1.xml"

    Any how to deal with this .. easily ?

    Of course, I can duplice the pano1.xml code into the main xml, and delete the onxmlcomplete part, but I'm looking for something better

  • When you use the include url="file.xml"... the contents of file.xml are parsed (correct word?) with the main.xml as if it was all one continuous file. (I'm pretty sure that's how Klaus explained it to me)... so with your setup... krpano.swf is seeing two onxmlcompletes... and looks like it's taking the second one (from the pano1.xml).

    You might be able to use "onpreviewcomplete" or "onloadcomplete" which were new event attributes introduced in 1.0.8 beta 6...

    link: http://www.krpano.com/forum/wbb/inde…D=1396#post1396

    You can see some of the other items included in previous beta releases here...
    http://www.krpano.com/forum/wbb/inde…tID=322#post322

  • I solved similar problems by creating a unique id per panorama and link it with a if statement to an action. the onxmlcomplete event gets triggered at every panorama change, it will look for a property called pano.name and compares what to do next.

    Main xml:

    pano1.xml

    Code
    <include url="main.xml" />
    <!-- custom attribute: -->
    <pano name="firstlocation" />

    pano2.xml

    Code
    <include url="main.xml" />
    <!-- custom attribute: -->
    <pano name="secondlocation" />

    Edit: I see you include the pano1.xml to the main instead otherway around. But this should still work. The <pano> object gets deleted at every change and the main stays, so it should work.

  • When you use the include url="file.xml"... the contents of file.xml are parsed (correct word?) with the main.xml as if it was all one continuous file. (I'm pretty sure that's how Klaus explained it to me)

    yes, that's right
    the <includes> are resolved while loading the main xml, it internally becomes one big file/structure,

    also note - if there are two or more times the same definition - then the order of them is important!
    the xml is parsed from top to down, so the latest one is that, that will be finally set!

    e.g.

    Code
    <events onxmlcomplete="trace(1. this will be never shown, because the next definitions will overwrite it);"/>
    <events onxmlcomplete="trace(2. this will be never shown too);"/>
    <events onxmlcomplete="trace(3. this text will be finally shown);"/>

    or the same with includes:
    main.xml:

    Code
    <events onxmlcomplete="trace(will not be shown);" />
    <include url="sub.xml" />

    sub.xml:

    Code
    <events onxmlcomplete="trace(this will be shown);" />


    the main.xml and sub.xml finally loaded become internally this code:

    Code
    <events onxmlcomplete="trace(will not be shown);" />
    <events onxmlcomplete="trace(this will be shown);" />


    so it should also be possible to solve this problem by resorting the xml code

    best regards,
    Klaus

  • Hi,

    Actually, this is not working for me.

    I've this in my main xml :

    and this in my sub xml :

    Code
    <events onpreviewcomplete="action(show_title,Panorama title);" 	/>

    and the only things I can see is "Panorama title"

    *unsure*

Participate now!

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