Accessing Storyline Variables from Inserted SWF

Sep 18, 2014

I would like to be able to access variables in the Storyline story.swf from my own swf that is inserted on a screen. It appears that all of the variables in the Player class are protected so I can't access them directly from my swf.

Is there a documented list of variables that can be accessed through JavaScript and the GetPlayer().GetVar("foo") interface?

Has anyone had any luck using ExternalInterface in an embedded swf for this purpose? When I try:

trace(ExternalInterface.call("GetVar","myVarName");

I get undefined, presumably because the GetVar() function is scoped within the Storyline swf and requires the GetPlayer().GetVar syntax. I've tried assigning GetPlayer() to an object within my swf and then trying GetVar("foo") on the object with no positive results.

It seems like I'll have to link my own js file into the story.html file, with a function that exposes GetVar() something like:

function myGetVar(_varName){

    var player = GetPlayer();

     return player.GetVar(_varName);

}

If this works then it raises the issue of having to add the link to the .js file to the story.html file each time I publish (and add the .js file to the output folder as well).

Is there a template for the story.html file that Storyline uses that I could add the .js link to as a permanent fix?

---

Lastly, is this the correct forum for asking these questions? If not, where?

Thanks,

Chris

5 Replies
Chris Manuel

Thanks Steve - I was hoping to access Storyline's internal, player variables (not my own custom variables) but haven't had any luck. Since the player variables are protected I was hoping the developers at Articulate would have implemented (and documented) Getter/Setters for the protected variables, exposing them to custom swfs loaded on a slide.

Clear as mud, I'm sure.

Steve Gannon

Hi Chris,

A couple of options:

1. You can use the SDK to access some of the player variables. However, this is only currently available for Storyline 1 and won't work with Storyline 2. Per this link, the SDK for SL2 is coming soon.

2. You can check out James' terrific Slide Info widget to access some of the internal variable values.

Not sure if either of the above meet your need but perhaps they'll provide a start.

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