Sample: SWF-Storyline communication

Jun 20, 2012

This is a new thread based on part of this discussion about timers.

Here is a link to a game I built in Storyline that incorporates a countdown timer developed in Flash:
(sorry, I'm not permitted to share the .story file for this game; it was developed for a client)

The need for this timer came about when we discovered an issue with SL's built-in quiz timer. Here's a small zipped .story file that demonstrates the problem. Articulate couldn't say when they would have this corrected and I needed to get this game completed so we built our own timer functionality.

My associate, Marc Lee, wrote the timer code in Flash ActionScript 3. We used the information from an article on James' blog to implement the communication between Flash and SL. (Thanks James!) Note that the code from James' article is incorporated into the Flash file, not the .story file. The resulting .swf communicates variable values with Storyline. It's crucial that the variables you use to communicate between Flash and Storyline exist in both the .swf and the .story files and that they both are of the same type (number vs. text/string).

Here's a link to a Storyline demo of the timer; this zip includes a small .story file, a .swf file, and the timer .fla source file.

If you're a Flash AS3 coder, this may open a lot of possibilities with your SL projects! Send me a private message if you have any questions.

Steve Gannon
GanTek Multimedia

19 Replies
Tom Dorsey

Thanks for sharing the Timer.  Very impressive.  I do have a couple quick questions.

Is it possible to synch the timer with the slide time line?  This way, when the time line is complete, the timer will automatically stop?

Is it possible to "pause" the timer?  For example, if a user clicks a custom pause/play button (usually takes another slide layer), the timer will pause?

Regards,

Tom

Steve Gannon

Hi Tom,

The answer to both of your questions is "no", not as currently coded. But with some additional coding in Flash, this could be accomplished. Just thinking out loud, two triggers would be set up on each slide to toggle one of two True/False variables...when the timeline ends or when the slide is paused. When the variable value changes, the timer SWF would be notified and it would stop or pause, accordingly.

- Steve

This discussion is closed. You can start a new discussion or contact Articulate Support.