WebObjects Communication with SL

All,

I would like a click on the webobject to update a variable in Storyline.  Has anyone had success being able to do this?

Details:

-1-Specifics in GetPlayer(SetVar) code in WO

-2-Publish for web and LMS

-3-Specific platform on webobject: HTML/Javascript/PHP/HTML5/Canvas

-4-Browsers where this does/does not work

Thanks in advance to anyone who knows how to do this.

-Marc Lee

16 Replies
Steve Flowers

Hey Marc - 

I have been able to do this using a parent reference.

One "gotcha" is publishing locally to Flash player, the player is security sandboxed and you can't talk Flash <> Javascript without adding it to the security manager whitelist, publishing and uploading to a web host, or publishing to CD and testing using the exe wrapper.

Steve Flowers

I have done this in the past. You'd either need to publish once and get the iframe id or use some script in the iframe to pass the value back outside of the iframe and use that reference to push into the webobject. Have done this in the past with some sprite animation controls in a web object. Worked well.

Steve Flowers

Second thought on this one... you'd need to either use the querystring in the request or setup a listener to a variable change in the parent. I think that's the way I solved the animation speed control in a web object.  

Getting window.frameElement.id from within the iFrame will grab the id of the current webobject. You could pass this back out to Storyline and use the reference to send a new URL into the iFrame.

Marc Lee

All,

Yes, Steve's code worked!  Thanks for posting this. It turned out that communications from the webobject to SL was not really the problem. It was getting the event listener in Javascript working right to send the information to SL.  Once that happened, parent.GetPlayer(SetVar) and (GetVar) worked perfectly in my webobject.

Also, Steve is again right that you can set up a listener in your webobject in Javascript to listen for a variable change in SL and, for example, pause your webobject animation from a button in SL.  I have done both directions in my project.

Thanks again for everyone's interest!

-Marc L

Kirk DesRosier

Steve Flowers said:

Second thought on this one... you'd need to either use the querystring in the request or setup a listener to a variable change in the parent. I think that's the way I solved the animation speed control in a web object.

Getting window.frameElement.id from within the iFrame will grab the id of the current webobject. You could pass this back out to Storyline and use the reference to send a new URL into the iFrame.


OK - So this is my problem but I'm not quite good enough at JS to figure out what you mean. All I need to do in my web object is get the value in an SL variable. parent.getplayer() works, but only when publishing to HTML not to .exe which is what I need.

Can you dig up an example where the trip was the other way?

Steve Flowers

Hi Eimar -

Are you attempting to run the file locally or from a Web server? If locally, the Flash Player Security feature would explain why communication between the Flash Storyline player and the browser is not working. To remedy:

1) Publish to CD to test locally, or

2) Upload to a Web server, or

3) Update your Flash Player Security Settings Manager to add your published folder location

Rahul Paul
Marc Lee

All,

Yes, Steve's code worked!  Thanks for posting this. It turned out that communications from the webobject to SL was not really the problem. It was getting the event listener in Javascript working right to send the information to SL.  Once that happened, parent.GetPlayer(SetVar) and (GetVar) worked perfectly in my webobject.

Also, Steve is again right that you can set up a listener in your webobject in Javascript to listen for a variable change in SL and, for example, pause your webobject animation from a button in SL.  I have done both directions in my project.

Thanks again for everyone's interest!

-Marc L

Hi Marc,

Can you please give an example of how you set up a listener in the web object to monitor a change in a variable in Storyline. I want to be able to create a custom playbar on my slide which will control a Youtube video playing inside a web object. The idea is to use the Youtube IFrame API to play or pause the video when a button on the Storyline slide is clicked.

Thanks in advance for your help.