Forum Discussion
Built-in scene title variable?
Thank you, Nadim, but I need the scene title. We work with scenes in so many ways, particularly as they apply to accessibility. I need that variable.
There doesn't seem to be any built-in variable containing the scene title. I looked quickly through the contents of the .story file and the published output, but nothing appears to be assigned to a variable. I see only a couple of options.
- Create a list of the scene names manually and enter them into SL variables, or into a variable array with JavaScript.
- You could extract the scene name (using JavaScript) from the DOM associated with the player's side menu. This requires that the menu is included in the project. If you publish without the menu, then this information will not be included.
For #2, you can use something like the following;
if(document.querySelector("div.cs-menu")) {
let sceneTitle = (
document.querySelector("div.cs-menu")
.querySelector(".cs-selected")
.parentNode
.parentNode
.parentNode
.querySelector("div.cs-listitem")
.querySelectorAll("span")[1]
.innerText
)
console.log(sceneTitle)
GetPlayer().setVar("curSceneTitle", sceneTitle)
}
This could probably be condensed, but it is clear this way and CSS selectors are not my strong suit. Sample project attached (script on master slide).
Demo: https://360.articulate.com/review/content/d4d714c4-6f1d-44df-ba4d-ad28b9eaaf82/review
You could also extract the entire list of scene names at once using a slightly different selector, if you wanted them all together.
If you publish your project for web, you can also see a complete text list of scene and slide names in the story_content/frame.xml file, near the end.
- BarbaraJacobs-15 months agoCommunity Member
This is great work. I hope the Articulate Engineers can appreciate how our community supports their efforts as well. Lots to go through for the moment.🤩
Related Content
- 10 months ago
- 4 months ago
- 10 months ago
- 10 months ago