The function of Layer components is to group components together so that changes can be applied to all components at a time.
For instance, if you wish to show and hide a number of components as a collective, assign them to a layer. Then you can toggle the layer between visible and invisible. As a result, the visibility of all children assigned to the layer will be changed the same way.
Creating a Layer Component
Simply drag and drop the Layer component from the Library into the Stage. Also, a corresponding entry will be created in the Scene Manager. You can drag the entry to its place in the Scene Manager.
Using a Layer Component
Layer components are a great way to stay organized when working with complex scenes. By assigning components to layers, you can affect them as a collective. This way you can change the appearance of many individual components with a single command.
In this example, you will learn how to work with two layers in a scene. You can find this example project as part of the Screencast 2.0 project, which is also treated in the screencasts on the same page. The settings have already been made in the demo project, so you can follow these steps to see how this project works.
Take a look at the Scene Manager in this demo project. The scene has two layers called "Template Touch" and "Template Presenter". Both layers are structurally identical. The difference in both layers is that different content assets were used.
This was achieved by creating a layer and then saving it as a template. The template was then re-added, and new content was assigned to the new layer. You can come to the same result by just duplicating the original layer and adjusting the content assets in the duplicate. However, in this case the template is not available in other projects.
Now that there are two layers of content, we can use actions to switch back and forth between them. This can be seen with the "Button Switch" and its corresponding Toggle Visible actions.
Assigning components to layers increases your productivity by saving you a lot of time. In addition, the Template feature allows you to recycle well-done components in other projects.