Back to the Shapespark home page

[API] Loading new scenes

Hi,

what would be the best practise to load new scenes (or replacing the current scene) dynamicly?
Normally, I would just link to another folder or file, so that a complete new page is loaded. But we have elements on the page, which should remain without being loaded again, like video-chat element. I tried to reinitialize a new scene by changing the assetUrl and creating a new WALK.getViewer(), which kinda works. But obviously it throws some errors. I could unload the entire html elements as well, so that they can be reinitialized and so on. But before I go on trying, I would like to know if there is a cleaner way. I am not thinking of fullsized iFrames in the background, which would work of course, but I think there could be a better way.

Cheers

Simon

Hi Simon,
I was able to do that with the iframe. You can change the source of iframe to a different scene dynamically. It’s been working fine for me.

2 Likes

@Simon, the viewer isn’t built with switching scenes in mind, so the way to go is embedding the viewer inside an iframe.

Do you anticipate a particular problem with applying iframe to your use case?

I wouldn’t call it a problem, I was just wondering if there was an alternative to iFrames. Thanks for the answer.