Skip to main content

Load Scenes from a String

In this example, we will show you how to load scenes from a string with the CreativeEditor SDK.

Explore a full code sample on Stackblitz or view the code on Github.

Loading an existing scene allows resuming work on a previous session or adapting an existing template to your needs. This can be done by passing a string that describes a scene to the engine.scene.loadFromString() function.


Saving a scene can be done as a either scene file or as an archive file (c.f. Saving scenes). A scene file does not include any fonts or images. Only the source URIs of assets, the general layout, and element properties are stored. When loading scenes in a new environment, ensure previously used asset URIs are available. Conversely, an archive file contains within it the scene's assets and references them as relative URIs.

In this example, we fetch a scene from a remote URL and load it as a string. This string could also come from the result of engine.scene.saveToString().

We can pass that string to the engine.scene.loadFromString(sceneContent: string): Promise<number>) function. The editor will then reset and present the given scene to the user. The function is asynchronous and the returned Promise resolves, if the scene load succeeded.

From this point on we can continue to modify our scene. In this example, assuming the scene contains a text element, we add a drop shadow to it. See Modifying Scenes for more details.

Scene loads may be reverted using cesdk.engine.editor.undo().

To later save your scene, see Saving Scenes.