Storyline and swf / Flash Communication

May 18, 2012

Dear everyone,

  • Send a value from flash to Storyline ?
    Do you think there is a way to catch a variable value in a swf and use its value in Storyline ?
  • Send a value from Storyline to a flashmovie ?
    Is there a way to send a value in flash from Storyline ? (through javascript ?)
  • swf and triggers in Storyline.
    It seems that it is not possible to use triggers (click or whatever) with swf in the Storyline... am I right ?

Thanks for sharing your views of these matters...

Fab

15 Replies
Nancy Woinoski

They are awesome questions Fabrice. Can't really help you with the first question because I have not tried it yet, but you should be able to use JavaScript to send values to Storyline from Flash as well as from Flash to Storyline.

As for your third question, you are correct in that you can't use triggers to control objects within the swf, but you can place objects (such as an invisible button or sympol) on top of a swf and they can have triggers. 

fab se

Thank you Nancy.

  • The possibility to communicate with flash variables through javascript would enhance Storyline's power in a limitless extent.
    (for instance, you use a swf menu to control the slides and so on). I have to try harder to possibly succeed if it is doable.

if some members of the community have same expectations an goals... great.

  • yes, yes, yes, but when you place an object above a swf movie you lose the interactivity inside the flash object (rollover, click...).
Steve Flowers

I suspect once the SDK is released, this type of communication should be clarified.

For now:

  • Using a variable listener, you should be able to catch a change to a JavaScript variable from an SWF (SWF to SL communication). This requires you to create the variable in SL.
  • Polling a Javascript variable through Flash using ExternalInterface should enable you to send commands to a Flash file through Javascript variable values. This will require that you use a JavaScript trigger to update a JS variable.

Nothing automatic. But certainly possible.

Lars Lindgren

Any news or example code on this?

I agree with Fab, facilitating datacommunication between SL and embedded SWFs as well as webobjects in the iframe would make SL borderless and very powerful indeed.

With this in place anyone could add on their own flash "plug-ins" to create whatever feature, functionality one could ever want.

Cheers,

/L

Björn Cronqvist

Hi

Communication between SL to Flash and reverse is no problem.

You use the ExternalInterface in Flash to call the SL players GetVar and SetVar methods in both cases.

Example:

// [AS3 code]

// The following will GET a variable in SL, set a Actionscript variable and set the text for an instance named "itxt" (on stage)

var toFlash:String = ExternalInterface.call('GetPlayer().GetVar',"toFlash");

if(toFlash) itxt.text = toFlash;

// The following will SET a variable in SL from Flash

var fromFlash:String = "Hello from Flash";

ExternalInterface.call('GetPlayer().SetVar','fromFlash',fromFlash);

//[AS3 code END]

This is all good and I guess you could build a Flash-based menu navigating through slides using conditions on variable changes:

You then need to setup one of these for each menu option.

Please let me know if you need more help.

What I am looking for, however, is either local variables (local to object, ie. SWF, or layer) or a way to pass parameters to each of the flash objects i have on the slide.

For instance:

I have three boxes with a textfield made in Flash which are all the same and I would like to pass different texts to each of them.

(The alternative would be three almost identical flash files with just the variable inside the flash different which sounds like a really bad idea. Especially when the result is to maintain dozens of flash files which work exactly the same way)

Anyway to accomplish that?

BR,

Björn Cronqvist

Björn Cronqvist

Björn Cronqvist said:

Hi

Communication between SL to Flash and reverse is no problem.

You use the ExternalInterface in Flash to call the SL players GetVar and SetVar methods in both cases.

Example:

// [AS3 code]

// The following will GET a variable in SL, set a Actionscript variable and set the text for an instance named "itxt" (on stage)

var toFlash:String = ExternalInterface.call('GetPlayer().GetVar',"toFlash");

if(toFlash) itxt.text = toFlash;

// The following will SET a variable in SL from Flash

var fromFlash:String = "Hello from Flash";

ExternalInterface.call('GetPlayer().SetVar','fromFlash',fromFlash);

//[AS3 code END]

This is all good and I guess you could build a Flash-based menu navigating through slides using conditions on variable changes:

You then need to setup one of these for each menu option.

NOTE: To be more clear and to be consistent - the above snapshot should handle variable fromFlash of course.

Please let me know if you need more help.

What I am looking for, however, is either local variables (local to object, ie. SWF, or layer) or a way to pass parameters to each of the flash objects i have on the slide.

For instance:

I have three boxes with a textfield made in Flash which are all the same and I would like to pass different texts to each of them.

(The alternative would be three almost identical flash files with just the variable inside the flash different which sounds like a really bad idea. Especially when the result is to maintain dozens of flash files which work exactly the same way)

Anyway to accomplish that?

BR,

Björn Cronqvist

David Jordan

Hello, currently dealing with an issue that the above suggestions seem to be a solution however i unable to get it to work. 

I have a swf file that has some interactions and and at some point in the swf i would like to have it trigger SL to go to the next slide. I have the following in my AS3 file:

//Section 3//
Section3.addEventListener(MouseEvent.CLICK, Start_Section3);
function Start_Section3(event:MouseEvent):void
{
var fromFlash:String = "Hello from Flash";
ExternalInterface.call('GetPlayer().SetVar','fromFlash',fromFlash);
}
//---------//

when they click the Section3 button it should execute the communication between flash and SL (as per the above sample.)

in SL i have the following trigger:

(attached as well)

 

When i run the SL project and click the button in flash, nothing happens. 

I even have a text field on screen with "  %fromFlash%  " in the field and notice that it does not change when the button is clicked.

from what i can find online, there may be a JS file needed to bridge the communication. I do not know JS well, or at all really.

I am at a bit of a standstill here, any help or a point in the right direction would be appreciated.

 

Thanks 

Christie Pollick

Hi, David -- Thanks for reaching out with your question! I wanted to share that JavaScript is not something for which we would be able to provide support, so hopefully some of the JS gurus in the community can chime in to assist you further. Here also is our JS Best Practices sheet if you'd like to check it out

One other thing to note, as this is an older thread and some of the participants may no longer be subscribed, is that you are welcome to reach out to participants directly using the 'Contact Me' link on an individual's profile page if you wish. :)

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