You are not logged in.

Dear visitor, welcome to Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.


Tuesday, July 17th 2018, 11:26pm

onloadcomplete => include xml...

hello there, i would like to know if it's possible to include and xml file only when the load is complete, cause sometimes the loading text keep in the middle of the pano...
and i use some feature like GET "session" and GET "cookies" and they are not loaded in first... and i need to delayedcall all my action to get the right result but sometime 5sec is not enouth...
that's why i want to include my xml only when the scene itself was full loaded...
thx :)


Wednesday, July 18th 2018, 12:59am

delays are bad...
one possibility is to set some (krpano) check variables and use callwhen

callwhen(session_ok AND cookies_ok,
.... do something ... );

in your session/cookie actions, when finished and ready you do
set(session_ok, true);
set(cookies_ok, true);


Wednesday, July 18th 2018, 9:21am

yes but i really need to have the state load complete 'cause sometimes the (loading) text still appear...

i've tried => <include url="my.xml" if="events.onloadcomplete == 'true'"/>

but it's not good and no error...


Wednesday, July 18th 2018, 9:50am

that doesnt work this way...

events.onloadcomplete is an action you can define like this:
<events onloadcomplete="set(pano_loaded,true);" />

<action "isready" autorun="onstart">
... your hide loading text code ... );

or simpler

<events onloadcomplete="... your hide loading text code ... " />

but this should work automatically
maybe you mixed up something in the standard xmls
or your server has a problem...


Wednesday, July 18th 2018, 10:20am

it's because i load lots of xml... in my tour i load 1 xml who load 6-7xml
and all of them lots maybe 15-20 layers and they made some request on my server.
all work but sometimes "loading" keep on the view and sometimes my Session is not get at time... depending the computer and the connection...
that why i need to include my xml only when the loading is ended..
i've try your solution

<events onloadcomplete="set(_loaded, true); trace(get(_loaded));"/>

<include url="my.xml" if="_loaded == true"/>

but the if condition need to be declared before the xml is open...

then i've tried

<events onloadcomplete="set(_loaded, true); trace(get(_loaded));"/>

<include url="include.xml"/>

<include url="my2.xml" if="_loaded == true"/>

<include url="my3.xml" if="_loaded == true"/>

<include url="my4.xml" if="_loaded == true"/>

but they don't come... trace say = true...


Wednesday, July 18th 2018, 11:24am

i've tested another method... but not work :D


it's good when my scene is loaded it's load my new xml but as pano... does can i do this things with loadxml ?

like :

<events onloadcomplete="loadxml('<krpano><include url="my.xml"/></krpano>')";/>

*whistling* *whistling* *whistling* *whistling*

XML parsing...


Wednesday, July 18th 2018, 11:59am

better dont think of loading your xmls when everything is ready

load your xmls normally, but dont do anything until everything is loaded
that needs waiting for one or more signals (with callwhen)
and of course setting each signal if a thing is done/loaded

events onloadcomplete only says the panorama is loaded
for layers with images you must use the layers onloaded events

if you have a lot of image layers you can use a counter
<layer name="..." url="...jpg" onloaded="inc(image_counter);" />
callwhen(.... AND image_counter == xx, .... );

or.. just disable the loading text :)


Thursday, July 19th 2018, 9:36am

finaly i've doing another way,
onloadcompleted = set my layer visible true, check if session ok...

action check session
if session ok then set layer visible
if not => delayedcall(0.4, check session)

and with that, the loading desapear all the time and my session are found with 100% accuracy

thx *thumbsup*