Start a new topic

Creating a close button in-world

Creating a close button in-world


So when my worlds load I get a fullscreen experience.

I've overlayed a close button (<button id="close">CLOSE</button)

How do I call the ARchitectWorld and tell it to close?
And can I call another function in the actual app (non-ARchitectWorld), since all the variables will be out of scope?

 

This is what I have:

var close = document.getElementById('close');

 

close.addEventListener('click', function(){

    if(typeof WikitudePlugin !== "undefined" && WikitudePlugin.close){

      WikitudePlugin.close();

    }else{

      alert('Incorrect close handler');

    }

});

Hi,
as you already mentioned, the ARchitect World and the PhoneGap application can't communicate directly with each other. So if you want to close the WikitudePlugin within the ARchitect World, you have to use the 'onURLInvoked' mechanism to communicate between those two parts.

Use app.wikitudePlugin.setOnUrlInvokeCallback(app.onURLInvoked); to register a function in your PhoneGap part that is called each time a document.location = architectsdk:// url is loaded. You can append any parameter to the architectsdk:// url and parse them in your onURLInvoked method. When you received a url which has e.g. a close parameter, simply use app.wikitudePlugin.close() to close the Wikitude SDK.

 

Best regards

Andreas
Login or Signup to post a comment