Storyboard: Multiple Scenes, One Module

Hi All,

The blog article Storyboard Scene Events Explained states:

All scene objects are created using the storyboard.newScene() function.
You can create as many scenes as you want in a single module..

However the examples offered only go on to explain the preferred approach of one module/file per scene. I’ve just started the process of putting together a simple ebook/interactive adventure app and didn’t really relish the idea of having to create one scene per page, since the logic will remain the same throughout (even the UI controls can be programatically generated).

What is the best layout then for handling multiple Storyboard scenes within one file? I guess having a decorator-type pattern for a ‘book’ to wrap the generation and switching from/to scenes?

Any examples somebody could think of to guide me would be much appreciated :slight_smile: [import]uid: 122384 topic_id: 24036 reply_id: 324036[/import]

Ended up finding out that I can reload the same scene that already exists, forcing the trigger of enterScene and exitScene to fire.

So now I’m just passing in values through the storyboard table and reloading the scene to represent a more generic ‘page’ and the variables passed in as userdata are now used to select from the ebook/page data what to render in the scene. [import]uid: 122384 topic_id: 24036 reply_id: 96896[/import]

@angryphase, as i understood, you are not able to do transitions, right ?
also, I assume that createScene event is not triggered when using storyboard.reloadScene(), does this mean that you create your display objects in “enterScene” event handler instead ?
looking forward to hear about your experience on this, as I am also trying to build storyboard scenes dynamically without the use od modules (for each scene).
thanx
[import]uid: 80100 topic_id: 24036 reply_id: 100816[/import]

I didn’t attempt to use any transitions in the tests I was doing and unfortunately the app has changed to a broken state right now, so it isn’t working as it was to quickly test it.

Also, I didn’t actually use the reloadScene method, instead I was just calling gotoScene with the same target as the scene I was already in.

So I have a ‘page’ scene that loads the relevant text and any images. On a swipe I was once again calling gotoScene(‘page’), but altering a couple of values that were constant (currentPage for example).

I also stored the full details of the text, images and (in my case) a set of decisions the user can make (similar to Choose Your Own Adventure books) in a table which was attached to storyboard.adventure. The full story was loaded from a Menu page which included a list of possible ‘adventures’ to chosen, so I use a JSON file to do that.

My only handlers are touch (for the page swipe), enterScene (here I instantiate the text and image display and any other dynamic items) and exitScene (where I use display.remove on the text and images).

Hope that gives you some guidance :slight_smile: [import]uid: 122384 topic_id: 24036 reply_id: 101066[/import]