Execution of Script actions on interruption by System.hidden

58 views
Skip to first unread message

maf

unread,
Jun 8, 2015, 7:49:36 AM6/8/15
to fla...@googlegroups.com
Working on a project that requires a lot of audio and animated narrative, for example a game tutorial - play some audio instruction, then play an animation to highlight something visually, then play another piece of audio, etc.

The script component combined with PlaySound, PlayMovie, Sequence, Parallel, and CallFunction works brilliantly for all this stuff BUT there are some problems, namely that if the browser tab focus is lost (System.hidden set to false), sounds are automatically paused. While they normally resume when the game receives focus back, the sound's context within the flow of the Script component's execution can be lost, potentially leaving the game in a broken state.

Just done some further testing across different browsers and targets (html/flash) - in safari and firefox (osx) html builds work perfectly - sounds and animations are paused and resumed in line with browser focus, subsequent actions are executed - all is good. However, in Chrome HTML and Flash builds on all browsers Script execution does not resume if a PlaySound action is interrupted and, worst of all, in Chrome, a flash build does not pause or resume PlayMovie actions meaning.

It's a shame as the Script component provides such an elegant way of implementing functionality like this, which can otherwise get very complicated very quickly. Quite new to Flambe (but so far very impressed) - as I start to look into ways around this I'm wondering if anyone has come up against this or developed any workarounds or solutions to this problem, or has any thoughts on best ways to approach it?


Carolina ospina

unread,
Jun 12, 2015, 3:11:34 PM6/12/15
to fla...@googlegroups.com
Hello, I did the same in a game that developed, the solution I recommend is that you use "System.externall.call" and execute the sounds from javascript that can help you a lot.

Greetings.

robin....@redspace.com

unread,
Jun 18, 2015, 2:12:25 PM6/18/15
to fla...@googlegroups.com
I'm having a similar issue involving the playback object's complete boolean not being set to true when you tab in and out of the game. Calling all sounds from javascript isn't an option for this project.

Any help here would be greatly appreciated.

ma...@soplausible.com

unread,
Jun 19, 2015, 10:46:21 AM6/19/15
to fla...@googlegroups.com, robin....@redspace.com
currently thinking of running a Delay action in parallel with the sound, with a duration matching that of the sound - this should pause and resume successfully and any on complete functionality can then be triggered by the Delay completing instead of relying on the sound resuming. Will post results soon...
Reply all
Reply to author
Forward
0 new messages