on load complete event on javascript class

  • Hi,

    how can i access
    --- in xml ---
    " <events onloadcomplete='hideprogressbar();'/> "

    in javascript class
    krpano().set("events.onloadcomplete", hideprogressbar);

    but i could not able to get the event

    if my code is wrong then plz help me solve the issue with the complete simple sample file.

  • How can we get a even to javascript class where all images are loaded on the stage if i mentioned in xml
    <events onmousedown="set(syncother,true);" onmousewheel="events.onmousedown();" onloadcomplete="events.onloadcomplete()" onloaddone="events.onloaddone()" onxmlcomplete="events.onxmlcomplete()" />

    and in javascript
    ...

    interval = setInterval(loadPanoXML, 500);
    function loadPanoXML() {
    clearInterval(interval);
    try{
    var krpano = $("#krpanoContainer").get(0);
    if(krpano){
    krpano.set('events.onxmlcomplete',hideprogressbar());
    krpano.set('events.onloaded',hideprogressbar1());
    krpano.set('events.onloaddone',hideprogressbar2());
    }
    }catch(e){
    console.log(e);
    }
    }

    on the above code i am getting all events together at the same time. even on the same images are loading only.. when we rotate the image some images are not loaded on stage.

    plz provided some solution for this.

    regards

    Jophine

  • Hi,

    How can we get a even to javascript class where all images are loaded

    just:

    xml:

    Code
    <events onloadcomplete="js( js_onloadcomplete() );" />

    js:

    Code
    function js_onloadcomplete()
    {
      ...
    }


    <events onmousedown="set(syncother,true);" onmousewheel="events.onmousedown();" onloadcomplete="events.onloadcomplete()" onloaddone="events.onloaddone()" onxmlcomplete="events.onxmlcomplete()" />

    That code doesn't make any sense - should the events call their-self again? That should result in an end-less loop... (which should be automatically stopped after some time when the limit of actions will be reached).

    Best regards,
    Klaus

  • Thank you very much

    but still i have some more issues in krpano javascript version

    1. if we can generate an xml dynamically and pass with parameter like

    Code
    krpano.call("loadxml(" + escape(generateXML(true)) + ")");"
    
    
    function generateXML(flag) {	var xmlString = "  loadscene(get(scene[0].name), null, MERGE); set(isFlag,+this.flag+); 	 	  	     			   		 	 "		return xmlString;}

    here i could not able to set the value of isFlag is any way to set this.

    2. for make a call to loadxml is required some time delay

    Code
    viewer = createPanoViewer({ swf: "pano.swf", id: "krpano", xml: xmlPath, target: container, width: width, height: height }); viewer.addParam("wmode", "transparent"); // viewer.call("loadxml(" + escape(generateXML(true)) + ")");"    ------------ this line gives error


    without any interval how can i call loadxml and pass the xml

    getting stuck with these issues in out project
    plz provide help for me

  • Hi,

    the 'viewer' embedding object doesn't provide a 'call' function!
    See here for the functions of that object:
    https://krpano.com/docu/html/#embeddingobject

    You would need to use the object with the with embedding 'id':
    https://krpano.com/docu/js/#top

    And note - this object will be created dynamically and so you need to wait it is loaded/created/embedded and ready of course!
    Either (constantly) check if that object and its set/get/call functions are already there or better use a callback from xml to js to make sure the viewer is ready.

    Best regards,
    Klaus

  • hello,

    I've got this to work with loadxml via events tag, but the downside is I need to have my function in window scope. is there any way I could supply function reference to loadxml, so that local scope function could be used to handle load completion?

    thanks.

  • There are several possibilities - e.g. here one - set a krpano variable to your JS function, then call krpano code and after it you function.
    That function will be still the in the right scope.

  • Thanks, this helps.

    Actually wait, it's not ( It does not seem to wait for the image to load, but fires right away with loadxml call.

    Edited once, last by makc (November 17, 2017 at 1:28 AM).

Participate now!

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