Sie sind nicht angemeldet.

1

Dienstag, 12. Mai 2009, 17:12

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 : http://krpano.com/examples/108b7/examples/scenes/scenes.html

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

If I put a

Quellcode

1
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

Quellcode

1
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
VideoStitch, a video stitching engine / blog sur les visites virtuelles ( french ).

Graydon

Profi

Beiträge: 614

Wohnort: Texas

Beruf: Industrial gas turbine services.

  • Nachricht senden

2

Mittwoch, 13. Mai 2009, 04:14

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/index.ph…D=1396#post1396

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

Zephyr

Profi

Beiträge: 1 003

Wohnort: Netherlands

Beruf: Web developer

  • Nachricht senden

3

Mittwoch, 13. Mai 2009, 09:36

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:

Quellcode

1
2
3
4
5
6
7
8
9
10
11
<events onxmlcomplete="action(onxmlloadactions)" />
<action name="onxmlloadactions" >
	if (pano.name EQ firstlocation,
		showtext(whatever you like);
		action(anotheraction you wish);
		);
	if (pano.name EQ secondlocation,
		showtext(whatever you like);
		action(anotheraction you wish);
		);
</action>


pano1.xml

Quellcode

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


pano2.xml

Quellcode

1
2
3
<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.

4

Mittwoch, 13. Mai 2009, 17:13

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.

Quellcode

1
2
3
<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:

Quellcode

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


sub.xml:

Quellcode

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



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

Quellcode

1
2
<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

5

Mittwoch, 20. Mai 2009, 23:37

Hi,

Actually, this is not working for me.

I've this in my main xml :

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
	<include url="%SWFPATH%/xml/sub.xml" />

	<events 	onpreviewcomplete="action(onpreviewcomplete);"
			/>

	<action name="show_title">
		showtext(%1,infostyle_quick);
	</action>

	<action name="onpreviewcomplete">
		showtext(Welcome, infostyle);
		delayedcall(6, showtext(Second text, infostyle););
	</action>


and this in my sub xml :

Quellcode

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


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

*unsure*
VideoStitch, a video stitching engine / blog sur les visites virtuelles ( french ).

Graydon

Profi

Beiträge: 614

Wohnort: Texas

Beruf: Industrial gas turbine services.

  • Nachricht senden

6

Samstag, 23. Mai 2009, 07:35

I'm taking a shot in the dark... but have you tried renaming your action onpreviewcomplete to something else to make sure there's not some conflict with using that name?

*confused*